public abstract class AbstractProtocolAuthService<R> extends Object implements ProtocolAuthService<R>
Implement #validateIdentity and #validateAuthority method template.
| 限定符和类型 | 字段和说明 |
|---|---|
protected AuthConfigs |
authConfigs |
| 限定符 | 构造器和说明 |
|---|---|
protected |
AbstractProtocolAuthService(AuthConfigs authConfigs) |
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
enableAuth(Secured secured)
Judgement whether enable auth feature according to secured information.
|
protected Resource |
parseSpecifiedResource(Secured secured)
Get resource from secured annotation specified resource.
|
protected Resource |
useSpecifiedParserToParse(Secured secured,
R request)
Parse resource by specified resource parser.
|
boolean |
validateAuthority(IdentityContext identityContext,
Permission permission)
Validate identity whether had permission for the resource and action.
|
boolean |
validateIdentity(IdentityContext identityContext,
Resource resource)
Validate identity whether is legal.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitinitialize, parseIdentity, parseResourceprotected final AuthConfigs authConfigs
protected AbstractProtocolAuthService(AuthConfigs authConfigs)
public boolean enableAuth(Secured secured)
ProtocolAuthService
configuration authEnabled in AuthConfigs is the main switch.
If authEnabled is false, this method and other follow methods should not be called.
This method is only for plugin to judge whether auth this Secured.
For example, plugins can only auth for write action or only for naming type request.
enableAuth 在接口中 ProtocolAuthService<R>secured - secured informationtrue if enable auth, otherwise falsepublic boolean validateIdentity(IdentityContext identityContext, Resource resource) throws AccessException
ProtocolAuthServicevalidateIdentity 在接口中 ProtocolAuthService<R>identityContext - identity contextresource - resourcetrue if legal, otherwise falseAccessException - exception during validatingpublic boolean validateAuthority(IdentityContext identityContext, Permission permission) throws AccessException
ProtocolAuthServicevalidateAuthority 在接口中 ProtocolAuthService<R>identityContext - identity contextpermission - permission include resource and actiontrue if legal, otherwise falseAccessException - exception during validatingprotected Resource parseSpecifiedResource(Secured secured)
secured - secured annotationCopyright © 2018–2023 Alibaba Group. All rights reserved.