Package io.dropwizard.auth
Interface Authorizer<P extends Principal>
-
- Type Parameters:
P- the type of principals
- All Known Implementing Classes:
CachingAuthorizer,ExampleAuthorizer,PermitAllAuthorizer
public interface Authorizer<P extends Principal>An interface for classes which authorize principal objects.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description booleanauthorize(P principal, String role, @Nullable jakarta.ws.rs.container.ContainerRequestContext requestContext)Decides if access is granted for the given principal in the given role.default AuthorizationContext<P>getAuthorizationContext(P principal, String role, @Nullable jakarta.ws.rs.container.ContainerRequestContext requestContext)Returns anAuthorizationContextobject, to be used inCachingAuthorizeras cache key.
-
-
-
Method Detail
-
authorize
boolean authorize(P principal, String role, @Nullable jakarta.ws.rs.container.ContainerRequestContext requestContext)
Decides if access is granted for the given principal in the given role.- Parameters:
principal- aPrincipalobject, representing a userrole- a user rolerequestContext- a request context.- Returns:
true, if the access is granted,false otherwise- Since:
- 2.0
-
getAuthorizationContext
default AuthorizationContext<P> getAuthorizationContext(P principal, String role, @Nullable jakarta.ws.rs.container.ContainerRequestContext requestContext)
Returns anAuthorizationContextobject, to be used inCachingAuthorizeras cache key.- Parameters:
principal- aPrincipalobject, representing a userrole- a user rolerequestContext- a request context.- Returns:
AuthorizationContextobject, to be used inCachingAuthorizer.- Since:
- 2.1
-
-