Top Description Fields Constructors Methods
io.undertow.security.handlers

public abstract Class AbstractConfidentialityHandler

extends Object
implements HttpHandler
Class Inheritance
All Implemented Interfaces
io.undertow.server.HttpHandler
Known Direct Subclasses
io.undertow.security.handlers.SinglePortConfidentialityHandler
Imports
java.net.URI, .URISyntaxException, io.undertow.UndertowLogger, io.undertow.server.HttpHandler, .HttpServerExchange, io.undertow.util.Headers, .StatusCodes

Handler responsible for checking of confidentiality is required for the requested resource and if so rejecting the request and redirecting to a secure address.
Author
Darran Lofthouse

Field Summary

Modifier and TypeField and Description
private final HttpHandler

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
protected boolean

Returns:

true if the request requires confidentiality, false otherwise.
confidentialityRequired
(final HttpServerExchange
- The HttpServerExchange for the request being processed.
exchange
)

Use the HttpServerExchange to identify if confidentiality is required.

protected abstract URI

Returns:

The URI to redirect to.
getRedirectURI
(final HttpServerExchange
- The HttpServerExchange for the request being processed.
exchange
)

All sub-classes are required to provide an implementation of this method, using the HttpServerExchange for the current request return the address to use for a redirect should confidentiality be required and the request not be confidential.

public void
handleRequest(HttpServerExchange
the HTTP request/response exchange
exchange
)

Implements io.undertow.server.HttpHandler.handleRequest.

Handle the request.

protected boolean

Returns:

true if the request is 'sufficiently' confidential, false otherwise.
isConfidential
(final HttpServerExchange
- The HttpServerExchange for the request being processed.
exchange
)

Use the HttpServerExchange supplied to check if this request is already 'sufficiently' confidential.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

nextback to summary
private final HttpHandler next

Constructor Detail

AbstractConfidentialityHandlerback to summary
protected AbstractConfidentialityHandler(final HttpHandler next)

Method Detail

confidentialityRequiredback to summary
protected boolean confidentialityRequired(final HttpServerExchange exchange)

Use the HttpServerExchange to identify if confidentiality is required. This method currently returns true for all requests, sub-classes can override this to provide a custom check.

Todo

we should deprecate this and just use a predicate to decide to execute the handler instead

Parameters
exchange:HttpServerExchange

- The HttpServerExchange for the request being processed.

Returns:boolean

true if the request requires confidentiality, false otherwise.

getRedirectURIback to summary
protected abstract URI getRedirectURI(final HttpServerExchange exchange) throws URISyntaxException

All sub-classes are required to provide an implementation of this method, using the HttpServerExchange for the current request return the address to use for a redirect should confidentiality be required and the request not be confidential.

Parameters
exchange:HttpServerExchange

- The HttpServerExchange for the request being processed.

Returns:URI

The URI to redirect to.

handleRequestback to summary
public void handleRequest(HttpServerExchange exchange) throws Exception

Implements io.undertow.server.HttpHandler.handleRequest.

Doc from io.undertow.server.HttpHandler.handleRequest.

Handle the request.

Parameters
exchange:HttpServerExchange

the HTTP request/response exchange

Annotations
@Override
isConfidentialback to summary
protected boolean isConfidential(final HttpServerExchange exchange)

Use the HttpServerExchange supplied to check if this request is already 'sufficiently' confidential. Here we say 'sufficiently' as sub-classes can override this and maybe even go so far as querying the actual SSLSession.

Parameters
exchange:HttpServerExchange

- The HttpServerExchange for the request being processed.

Returns:boolean

true if the request is 'sufficiently' confidential, false otherwise.