winglet/authclient
Composer 安装命令:
composer require winglet/authclient
包简介
Client package for the Winglet Auth microservice.
README 文档
README
Packagist client package for the Winglet Auth microservice.
The package is intentionally light: request/response payloads are arrays so the client remains compatible with older PHP application code while still covering the current Auth API surface.
Install
composer require winglet/authclient
Usage
use Winglet\AuthClient\AuthClient;
$auth = AuthClient::fromBaseUrl(
'http://auth-service',
bearerToken: $serviceToken,
);
$effective = $auth->getEffectiveAuthorization(identityId: 123, tenantId: null);
$check = $auth->checkAuthorization(123, 'templify.admin');
Included endpoints
Authorization
getEffectiveAuthorization(int $identityId, ?int $tenantId = null)→GET /authorization/effectivecheckAuthorization(int $identityId, string $permissionCode, ?int $tenantId = null)→POST /authorization/checkgetGlobalAuthorizationRevision(int $identityId)→GET /authorization/revisions/global/{identityId}getTenantAuthorizationRevision(int $identityId, int $tenantId)→GET /authorization/revisions/tenant/{identityId}/{tenantId}
Roles
listRoles(?string $scope = null, ?bool $includeDeprecated = null)createRole(array $data)getRole(int $id)updateRole(int $id, array $data)deleteRole(int $id)addPermissionToRole(int $roleId, int $permissionId)removePermissionFromRole(int $roleId, int $permissionId)
Permissions
listPermissions(?string $scope = null, ?bool $includeDeprecated = null)createPermission(array $data)getPermission(int $id)updatePermission(int $id, array $data)deletePermission(int $id)
Global assignments and grants
listGlobalRoleAssignments(?int $identityId = null, ?int $roleId = null, ?string $status = null)createGlobalRoleAssignment(array $data)getGlobalRoleAssignment(int $id)updateGlobalRoleAssignment(int $id, array $data)revokeGlobalRoleAssignment(int $id, ?string $reason = null)listGlobalPermissionGrants(?int $identityId = null, ?int $permissionId = null, ?string $status = null)createGlobalPermissionGrant(array $data)getGlobalPermissionGrant(int $id)updateGlobalPermissionGrant(int $id, array $data)revokeGlobalPermissionGrant(int $id, ?string $reason = null)
Tenants and tenant-scoped assignments
listTenants(?string $code = null)getTenant(int $id)upsertTenant(int $id, array $data)listTenantMemberships(?int $identityId = null, ?int $tenantId = null, ?string $status = null)createTenantMembership(array $data)getTenantMembership(int $id)updateTenantMembership(int $id, array $data)revokeTenantMembership(int $id, ?string $reason = null)listTenantRoleAssignments(?int $tenantMembershipId = null, ?int $roleId = null, ?string $status = null)createTenantRoleAssignment(array $data)getTenantRoleAssignment(int $id)updateTenantRoleAssignment(int $id, array $data)revokeTenantRoleAssignment(int $id, ?string $reason = null)listTenantPermissionGrants(?int $tenantMembershipId = null, ?int $permissionId = null, ?string $status = null)createTenantPermissionGrant(array $data)getTenantPermissionGrant(int $id)updateTenantPermissionGrant(int $id, array $data)revokeTenantPermissionGrant(int $id, ?string $reason = null)
Bootstrap
initializeBootstrap(int $rootIdentityId, ?string $reason = null)
Tests
composer install
composer test
The test suite uses a fake transport and does not require a running Auth service.
Payload examples
$auth->createPermission([
'code' => 'templify.admin',
'name' => 'Templify admin',
'scope' => 'global',
]);
$auth->createRole([
'code' => 'admin',
'name' => 'Administrator',
'scope' => 'global',
'permissionIds' => [1, 2, 3],
]);
$auth->createGlobalRoleAssignment([
'identityId' => 123,
'roleId' => 1,
'status' => 'active',
]);
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: proprietary
- 更新时间: 2026-06-19