public final class SecurityHandler extends Object implements Handler
WebSecurity.create(Config)
or WebSecurity.create(Security, Config).| Modifier and Type | Class and Description |
|---|---|
static class |
SecurityHandler.QueryParamHandler
Handler of query parameters - extracts them and stores
them in a security header, so security can access them.
|
Handler.EntityHandler<T>| Modifier and Type | Method and Description |
|---|---|
void |
accept(ServerRequest req,
ServerResponse res)
|
SecurityHandler |
audit()
Audit this request for any method.
|
SecurityHandler |
auditEventType(String eventType)
Override for event-type, defaults to .
|
SecurityHandler |
auditMessageFormat(String messageFormat)
Override for audit message format, defaults to .
|
SecurityHandler |
authenticate()
If called, request will go through authentication process - (authentication is disabled by default - it may be enabled
as a side effect of other methods, such as
rolesAllowed(String...). |
SecurityHandler |
authenticationOptional()
If called, authentication failure will not abort request and will continue as anonymous (authentication is not optional
by default).
|
SecurityHandler |
authenticator(String explicitAuthenticator)
Use a named authenticator (as supported by security - if not defined, default authenticator is used).
|
SecurityHandler |
authorize()
If called, request will go through authorization process - (authorization is disabled by default - it may be enabled
as a side effect of other methods, such as
rolesAllowed(String...). |
SecurityHandler |
authorizer(String explicitAuthorizer)
Use a named authorizer (as supported by security - if not defined, default authorizer is used, if none defined, all is
permitted).
|
SecurityHandler |
customObject(Object object)
Register a custom object for security request(s).
|
SecurityHandler |
queryParam(String queryParamName,
TokenHandler headerHandler)
Add a query parameter extraction configuration.
|
List<SecurityHandler.QueryParamHandler> |
queryParamHandlers()
List of query parameter handlers.
|
SecurityHandler |
rolesAllowed(String... roles)
An array of allowed roles for this path - must have a security provider supporting roles (either authentication
or authorization provider).
|
SecurityHandler |
skipAudit()
Disable auditing of this request.
|
SecurityHandler |
skipAuthentication()
If called, request will NOT go through authentication process.
|
SecurityHandler |
skipAuthorization()
Skip authorization for this route.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitandThenpublic void accept(ServerRequest req, ServerResponse res)
Handleraccept in interface Handleraccept in interface BiConsumer<ServerRequest,ServerResponse>req - an HTTP server request.res - an HTTP server response.public List<SecurityHandler.QueryParamHandler> queryParamHandlers()
public SecurityHandler authenticator(String explicitAuthenticator)
explicitAuthenticator - name of authenticator as configured in Securitypublic SecurityHandler authorizer(String explicitAuthorizer)
explicitAuthorizer - name of authorizer as configured in Securitypublic SecurityHandler rolesAllowed(String... roles)
skipAuthorization()
and skipAuthentication() if needed).roles - if subject is any of these roles, allow accesspublic SecurityHandler authenticationOptional()
public SecurityHandler authenticate()
rolesAllowed(String...).public SecurityHandler skipAuthentication()
rolesAllowed(String...)) and yet it is not desired (e.g. everything is handled by authorization).public SecurityHandler customObject(Object object)
object - An object expected by security providerpublic SecurityHandler auditEventType(String eventType)
eventType - audit event type to usepublic SecurityHandler auditMessageFormat(String messageFormat)
messageFormat - audit message format to usepublic SecurityHandler authorize()
rolesAllowed(String...).public SecurityHandler skipAuthorization()
rolesAllowed(String...) and
you want to explicitly forbid it.public SecurityHandler audit()
DEFAULT_AUDIT_EVENT_TYPE.
By default audit is enabled as follows (based on HTTP methods):
public SecurityHandler skipAudit()
By default audit is enabled as follows (based on HTTP methods):
public SecurityHandler queryParam(String queryParamName, TokenHandler headerHandler)
queryParamName - name of a query parameter to extractheaderHandler - handler to extract it and store it in a header fieldCopyright © 2018, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.