Package com.linecorp.armeria.server.auth
Interface Authorizer<T>
- All Known Implementing Classes:
AbstractAuthorizerWithHandlers
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Determines whether a given
data
is authorized for the service registered in.
ctx
can be used for storing authorization information about the request for use in
business logic. data
is usually an HttpRequest
or token extracted from it.-
Method Summary
Modifier and TypeMethodDescriptionauthorize
(ServiceRequestContext ctx, T data) Authorizes the givendata
.default CompletionStage<AuthorizationStatus>
authorizeAndSupplyHandlers
(ServiceRequestContext ctx, T data) Authorizes the givendata
.default Authorizer<T>
orElse
(Authorizer<T> nextAuthorizer) Returns a newAuthorizer
that delegates the authorization request to the specifiedAuthorizer
if thisAuthorizer
rejects the authorization request by returning aCompletionStage
completed withfalse
.
-
Method Details
-
authorize
Authorizes the givendata
.- Returns:
- a
CompletionStage
that will resolve totrue
if the request is authorized, orfalse
otherwise. If the future resolves exceptionally, the request will not be authorized.
-
authorizeAndSupplyHandlers
@UnstableApi default CompletionStage<AuthorizationStatus> authorizeAndSupplyHandlers(ServiceRequestContext ctx, @Nullable T data) Authorizes the givendata
.- Parameters:
ctx
-ServiceRequestContext
of the request being authorized.data
- an actual authorization data, likeHttpRequest
, token extracted from it ornull
if such authorization data is missing.- Returns:
- a
CompletionStage
that will resolve toAuthorizationStatus
. If the future resolves exceptionally, the request will not be authorized.
-
orElse
Returns a newAuthorizer
that delegates the authorization request to the specifiedAuthorizer
if thisAuthorizer
rejects the authorization request by returning aCompletionStage
completed withfalse
.
-