public interface Authorizer
In particular, this allows control over which requests require authentication, the mechanism for performing access control, and the handling of authentication failures.
AbstractAuthorizer
Modifier and Type | Method and Description |
---|---|
void |
handleAuthorization(Context context,
UserProfile userProfile)
Handles authorization for the given context.
|
boolean |
isAuthenticationRequired(Context context)
Determines whether authentication is required for a given context.
|
boolean isAuthenticationRequired(Context context)
If this method returns true
, unauthenticated users are redirected to the identity provider.
context
- The context to handlevoid handleAuthorization(Context context, UserProfile userProfile) throws Exception
This method is only called for requests that require authentication.
If the request is properly authorized, it's sufficient to call Context.next()
.
If the request is not properly authorized, it is this method's responsibility to either return an appropriate error response, or redirect to an error page.
context
- The context to handleuserProfile
- The authenticated user profileException
- if anything goes wrong (exception will be implicitly passed to the context's Context.error(Throwable)
method)isAuthenticationRequired(ratpack.handling.Context)