定制 openwod/service-accounts 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

openwod/service-accounts

最新稳定版本:1.0.0

Composer 安装命令:

composer require openwod/service-accounts

包简介

A package for adding service accounts to a Laravel project

README 文档

README

This package makes it possible to create service accounts and assign permissions to these. The package creates a couple of routes which you can use for creating/modifing service accounts.

Authentication

All routes require authentication. There are two ways of authenticating. 1. Using the api_token specified in service-accounts config file. (this has access to all routes) 2. By using a service account's token with the right permission.

Both types of tokens should be sent in the Authorization header, Format for service account's token "Bearer TOKEN" Format for api_token "ServiceAccount TOKEN"

Routes

POST /service_accounts
    Body:
        name
        permissions
            Comma separated list of permissions in format something.something
    Creates a new Service account
    Permission: service-accounts.create
    Returns service account token

GET /service_accounts/{name}
    Permission: service-accounts.view
    Returns information about a service account

DELETE /service_accounts/{name}
    Permission: service-accounts.destroy
    Deletes a service account

Install

1.

Run composer command to download package. More information comming...

2.

Add following to config/auth.php config:

Under guards add:

'svc' => [
	'driver' => 'sanctum',
	'provider' => 'svc',
    'hash' => true,
],

Under providers add:

'svc' => [
	'driver' => 'eloquent',
	'model' => Openwod\ServiceAccounts\Models\ServiceAccount::class,
],

3.

Add SERVICE_ACCOUNT_ADMIN_TOKEN to env. This token is used to authenticate requests to add new service accounts.

4.

Run php artisan vendor:publish --provider="Openwod\ServiceAccounts\ServiceAccountsServiceProvider" to publish files

5.

Run php artisan migrate

Usage

Get service account

$svc = auth()->guard('svc')->user();

Check permission

$svc->tokenCan('permission')

统计信息

  • 总下载量: 7
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-11-15

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固