ryo88c/bear.authority

BEAR.Sunday 的认证工具

v1.0.14 2020-11-04 06:27 UTC

This package is auto-updated.

Last update: 2024-09-04 14:26:34 UTC


README

BEAR.Sunday 用认证库。

使用方法

Ryo88c\Authority\Auth 注解指定到想要进行认证的资源对象的函数中。指定 @Auth(allow="admin") 则允许拥有 role 设置为 admin 的受众访问。

定制化

如果需要改变认证方法,请参考 Authorization 来实现 AuthorizationInterface。在 Authorization 类中,结合了 OAuth 2.0 Bearer 和 JSON Web Token 进行使用。

如果需要改变认证方法,请参考 Authentication 来实现 AuthenticationInterface。在 Authentication 类中,使用 JWT 的 RFC(RFC7519) 定义的 AudienceInterface 作为认证对象。如果需要实现除角色评估外的其他认证方法,或更改受众的数据定义,则需要实现 AuthenticationInterfaceAudienceInterface

此外,为了赋予 AudiencePayload 值对象的性质,有意不注入依赖而使用 new 创建。