@FunctionalInterface public interface Authorizer<T>
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.| Modifier and Type | Method and Description |
|---|---|
CompletionStage<Boolean> |
authorize(ServiceRequestContext ctx,
T data)
Authorizes the given
data. |
default Authorizer<T> |
orElse(Authorizer<T> nextAuthorizer)
Returns a new
Authorizer that delegates the authorization request to the specified
Authorizer if this Authorizer rejects the authorization request by returning
a CompletionStage completed with false. |
CompletionStage<Boolean> authorize(ServiceRequestContext ctx, T data)
data.CompletionStage that will resolve to true if the request is
authorized, or false otherwise. If the future resolves exceptionally, the request
will not be authorized.default Authorizer<T> orElse(Authorizer<T> nextAuthorizer)
Authorizer that delegates the authorization request to the specified
Authorizer if this Authorizer rejects the authorization request by returning
a CompletionStage completed with false.Copyright © 2020 LeanCloud. All rights reserved.