Top Description Inners Fields Constructors Methods
io.undertow.security.impl

public abstract Class AbstractSecurityContext

extends Object
implements SecurityContext
Class Inheritance
All Implemented Interfaces
io.undertow.security.api.SecurityContext
Known Direct Subclasses
io.undertow.security.impl.SecurityContextImpl
Static Imports
io.undertow.UndertowMessages.MESSAGES

A base class for SecurityContext implementations predominantly focusing on the notification handling allowing the specific implementation for focus on authentication.
Author
Darran Lofthouse

Nested and Inner Type Summary

Modifier and TypeClass and Description
protected static class
AbstractSecurityContext.Node<T>

To reduce allocations we use a custom linked list data structure

Field Summary

Modifier and TypeField and Description
private Account
private boolean
protected final HttpServerExchange
private String
private AbstractSecurityContext.Node<NotificationReceiver>

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public void
authenticationComplete(Account
- The authenticated Account
account
,
String
- The name of the mechanism used to authenticate the account.
mechanism
,
final boolean
- If this mechanism requires caching
cachingRequired
)

Implements io.undertow.security.api.SecurityContext.authenticationComplete.

Called by the AuthenticationMechanism to indicate that an account has been successfully authenticated.

protected void
authenticationComplete(Account account, String mechanism, boolean programatic, final boolean cachingRequired)

public void
authenticationFailed(String
- The message describing the failure.
message
,
String
- The name of the mechanism reporting the failure.
mechanism
)

Implements io.undertow.security.api.SecurityContext.authenticationFailed.

Called by the AuthenticationMechanism to indicate that an authentication attempt has failed.

public Account
getAuthenticatedAccount()

Implements io.undertow.security.api.SecurityContext.getAuthenticatedAccount.

Obtain the Account for the currently authenticated identity.

public String

Returns:

The name of the mechanism used to authenticate the request.
getMechanismName
()

Implements io.undertow.security.api.SecurityContext.getMechanismName.

public boolean
public boolean
public void
logout()

Implements io.undertow.security.api.SecurityContext.logout.

de-authenticates the current exchange.

public void
registerNotificationReceiver(NotificationReceiver
- The NotificationReceiver to register.
receiver
)

Implements io.undertow.security.api.SecurityContext.registerNotificationReceiver.

Register a NotificationReceiver interested in receiving notifications for security events that happen on this SecurityContext.

public void
private void
public void
setAuthenticationRequired()

Implements io.undertow.security.api.SecurityContext.setAuthenticationRequired.

Marks this request as requiring authentication.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

accountback to summary
private Account account
authenticationRequiredback to summary
private boolean authenticationRequired
exchangeback to summary
protected final HttpServerExchange exchange
mechanismNameback to summary
private String mechanismName
notificationReceiversback to summary
private AbstractSecurityContext.Node<NotificationReceiver> notificationReceivers

Constructor Detail

AbstractSecurityContextback to summary
protected AbstractSecurityContext(final HttpServerExchange exchange)

Method Detail

authenticationCompleteback to summary
public void authenticationComplete(Account account, String mechanism, final boolean cachingRequired)

Implements io.undertow.security.api.SecurityContext.authenticationComplete.

Doc from io.undertow.security.api.SecurityContext.authenticationComplete.

Called by the AuthenticationMechanism to indicate that an account has been successfully authenticated.

Note

A successful verification of an account using the IdentityManager is not the same as a successful authentication decision, other factors could be taken into account to make the final decision.

Parameters
account:Account

- The authenticated Account

mechanism:String

- The name of the mechanism used to authenticate the account.

cachingRequired:boolean

- If this mechanism requires caching

Annotations
@Override
authenticationCompleteback to summary
protected void authenticationComplete(Account account, String mechanism, boolean programatic, final boolean cachingRequired)
authenticationFailedback to summary
public void authenticationFailed(String message, String mechanism)

Implements io.undertow.security.api.SecurityContext.authenticationFailed.

Doc from io.undertow.security.api.SecurityContext.authenticationFailed.

Called by the AuthenticationMechanism to indicate that an authentication attempt has failed. This should only be called where an authentication attempt has truly failed, for authentication mechanisms where an additional round trip with the client is expected this should not be called. Where possible the failure message should contain the name of the identity that authentication was being attempted for, however as this is not always possible to identify in advance a generic message may be all that can be reported.

Parameters
message:String

- The message describing the failure.

mechanism:String

- The name of the mechanism reporting the failure.

Annotations
@Override
getAuthenticatedAccountback to summary
public Account getAuthenticatedAccount()

Implements io.undertow.security.api.SecurityContext.getAuthenticatedAccount.

Doc from io.undertow.security.api.SecurityContext.getAuthenticatedAccount.

Obtain the Account for the currently authenticated identity.

Returns:Account

The Account for the currently authenticated identity or null if no account is currently authenticated.

Annotations
@Override
getMechanismNameback to summary
public String getMechanismName()

Implements io.undertow.security.api.SecurityContext.getMechanismName.

Returns:String

The name of the mechanism used to authenticate the request.

Annotations
@Override
isAuthenticatedback to summary
public boolean isAuthenticated()

Implements io.undertow.security.api.SecurityContext.isAuthenticated.

Returns:boolean

Doc from io.undertow.security.api.SecurityContext.isAuthenticated.

true if a user has been authenticated for this request, false otherwise.

Annotations
@Override
isAuthenticationRequiredback to summary
public boolean isAuthenticationRequired()

Implements io.undertow.security.api.SecurityContext.isAuthenticationRequired.

Doc from io.undertow.security.api.SecurityContext.isAuthenticationRequired.

Returns true if authentication is required

Returns:boolean

true If authentication is required

Annotations
@Override
logoutback to summary
public void logout()

Implements io.undertow.security.api.SecurityContext.logout.

Doc from io.undertow.security.api.SecurityContext.logout.

de-authenticates the current exchange.

Annotations
@Override
registerNotificationReceiverback to summary
public void registerNotificationReceiver(NotificationReceiver receiver)

Implements io.undertow.security.api.SecurityContext.registerNotificationReceiver.

Doc from io.undertow.security.api.SecurityContext.registerNotificationReceiver.

Register a NotificationReceiver interested in receiving notifications for security events that happen on this SecurityContext.

Parameters
receiver:NotificationReceiver

- The NotificationReceiver to register.

Annotations
@Override
removeNotificationReceiverback to summary
public void removeNotificationReceiver(NotificationReceiver receiver)

Implements io.undertow.security.api.SecurityContext.removeNotificationReceiver.

Doc from io.undertow.security.api.SecurityContext.removeNotificationReceiver.

Remove a previously registered NotificationReceiver from this SecurityContext. If the supplied receiver has not been previously registered this method will fail silently.

Parameters
receiver:NotificationReceiver

- The NotificationReceiver to remove.

Annotations
@Override
sendNoticiationback to summary
private void sendNoticiation(final SecurityNotification notification)
setAuthenticationRequiredback to summary
public void setAuthenticationRequired()

Implements io.undertow.security.api.SecurityContext.setAuthenticationRequired.

Doc from io.undertow.security.api.SecurityContext.setAuthenticationRequired.

Marks this request as requiring authentication. Authentication challenge headers will only be sent if this method has been called. If authenticate() is called without first calling this method then the request will continue as normal even if the authentication was not successful.

Annotations
@Override
io.undertow.security.impl back to summary

protected final Class AbstractSecurityContext.Node<T>

extends Object
Class Inheritance

To reduce allocations we use a custom linked list data structure

Field Summary

Modifier and TypeField and Description
pack-priv final T
pack-priv AbstractSecurityContext.Node<T>

Constructor Summary

AccessConstructor and Description
private
Node(T item)

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

itemback to summary
pack-priv final T item
nextback to summary
pack-priv AbstractSecurityContext.Node<T> next

Constructor Detail

Nodeback to summary
private Node(T item)