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 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.default AuthorizationContext<P>
getAuthorizationContext(P principal, String role, @Nullable jakarta.ws.rs.container.ContainerRequestContext requestContext)
Returns anAuthorizationContext
object, to be used inCachingAuthorizer
as 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
- aPrincipal
object, 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 anAuthorizationContext
object, to be used inCachingAuthorizer
as cache key.- Parameters:
principal
- aPrincipal
object, representing a userrole
- a user rolerequestContext
- a request context.- Returns:
AuthorizationContext
object, to be used inCachingAuthorizer
.- Since:
- 2.1
-
-