Class AnonymousHttpSecuritySource
- java.lang.Object
-
- net.officefloor.web.spi.security.impl.AbstractHttpSecuritySource<HttpAuthentication<java.lang.Void>,HttpAccessControl,java.lang.Void,None,None>
-
- net.officefloor.web.security.scheme.AnonymousHttpSecuritySource
-
- All Implemented Interfaces:
java.io.Serializable,HttpAccessControl,HttpAuthentication<java.lang.Void>,HttpSecurity<HttpAuthentication<java.lang.Void>,HttpAccessControl,java.lang.Void,None,None>,HttpSecuritySource<HttpAuthentication<java.lang.Void>,HttpAccessControl,java.lang.Void,None,None>
public class AnonymousHttpSecuritySource extends AbstractHttpSecuritySource<HttpAuthentication<java.lang.Void>,HttpAccessControl,java.lang.Void,None,None> implements HttpSecurity<HttpAuthentication<java.lang.Void>,HttpAccessControl,java.lang.Void,None,None>, HttpAuthentication<java.lang.Void>, HttpAccessControl
HttpSecurityenable access to all roles.- Author:
- Daniel Sagenschneider
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class net.officefloor.web.spi.security.impl.AbstractHttpSecuritySource
AbstractHttpSecuritySource.DependencyLabeller, AbstractHttpSecuritySource.Labeller, AbstractHttpSecuritySource.MetaDataContext<A,AC extends java.io.Serializable,C,O extends java.lang.Enum<O>,F extends java.lang.Enum<F>>, AbstractHttpSecuritySource.SpecificationContext
-
-
Field Summary
-
Fields inherited from class net.officefloor.web.spi.security.impl.AbstractHttpSecuritySource
UTF_8
-
-
Constructor Summary
Constructors Constructor Description AnonymousHttpSecuritySource()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidauthenticate(java.lang.Void credentials, AuthenticateRequest authenticateRequest)Triggers to undertake authentication.voidauthenticate(java.lang.Void credentials, AuthenticateContext<HttpAccessControl,None,None> context)Undertakes authentication.voidchallenge(ChallengeContext<None,None> context)Triggers the authentication challenge to the client.HttpAuthentication<java.lang.Void>createAuthentication(AuthenticationContext<HttpAccessControl,java.lang.Void> context)Creates the custom authentication.HttpAccessControlgetAccessControl()Obtains theHttpAccessControl.java.lang.StringgetAuthenticationScheme()Obtains the authentication scheme used.java.lang.Class<java.lang.Void>getCredentialsType()Obtains the type of credentials.java.security.PrincipalgetPrincipal()Obtains thePrincipal.booleaninRole(java.lang.String role)Indicates if within role.booleanisAuthenticated()Indicates if authenticated.protected voidloadMetaData(AbstractHttpSecuritySource.MetaDataContext<HttpAuthentication<java.lang.Void>,HttpAccessControl,java.lang.Void,None,None> context)Overridden to load meta-data.protected voidloadSpecification(AbstractHttpSecuritySource.SpecificationContext context)Overridden to load specifications.voidlogout(LogoutRequest logoutRequest)Undertakes logging out.voidlogout(LogoutContext<None,None> context)Logs out.booleanratify(java.lang.Void credentials, RatifyContext<HttpAccessControl> context)Ratifies whether enough information is available to undertake authentication.HttpSecurity<HttpAuthentication<java.lang.Void>,HttpAccessControl,java.lang.Void,None,None>sourceHttpSecurity(HttpSecurityContext context)Sources theHttpSecurity.-
Methods inherited from class net.officefloor.web.spi.security.impl.AbstractHttpSecuritySource
getSpecification, init, start, stop
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.officefloor.web.security.HttpAccessControl
isAccess
-
-
-
-
Method Detail
-
loadSpecification
protected void loadSpecification(AbstractHttpSecuritySource.SpecificationContext context)
Description copied from class:AbstractHttpSecuritySourceOverridden to load specifications.- Specified by:
loadSpecificationin classAbstractHttpSecuritySource<HttpAuthentication<java.lang.Void>,HttpAccessControl,java.lang.Void,None,None>- Parameters:
context- Specifications.
-
loadMetaData
protected void loadMetaData(AbstractHttpSecuritySource.MetaDataContext<HttpAuthentication<java.lang.Void>,HttpAccessControl,java.lang.Void,None,None> context) throws java.lang.Exception
Description copied from class:AbstractHttpSecuritySourceOverridden to load meta-data.- Specified by:
loadMetaDatain classAbstractHttpSecuritySource<HttpAuthentication<java.lang.Void>,HttpAccessControl,java.lang.Void,None,None>- Parameters:
context- Meta-data.- Throws:
java.lang.Exception- If fails to load the meta-data.
-
sourceHttpSecurity
public HttpSecurity<HttpAuthentication<java.lang.Void>,HttpAccessControl,java.lang.Void,None,None> sourceHttpSecurity(HttpSecurityContext context) throws HttpException
Description copied from interface:HttpSecuritySourceSources theHttpSecurity.- Specified by:
sourceHttpSecurityin interfaceHttpSecuritySource<HttpAuthentication<java.lang.Void>,HttpAccessControl,java.lang.Void,None,None>- Parameters:
context-HttpSecurity.- Returns:
HttpSecurity.- Throws:
HttpException- If fails to source theHttpSecurity.
-
createAuthentication
public HttpAuthentication<java.lang.Void> createAuthentication(AuthenticationContext<HttpAccessControl,java.lang.Void> context)
Description copied from interface:HttpSecurityCreates the custom authentication.- Specified by:
createAuthenticationin interfaceHttpSecurity<HttpAuthentication<java.lang.Void>,HttpAccessControl,java.lang.Void,None,None>- Parameters:
context-AuthenticateContext.- Returns:
- Custom authentication.
-
ratify
public boolean ratify(java.lang.Void credentials, RatifyContext<HttpAccessControl> context)Description copied from interface:HttpSecurityRatifies whether enough information is available to undertake authentication.
As authentication will likely require communication with external services (LDAP store, database, etc), this method allows checking whether enough information is available to undertake the authentication. The purpose is to avoid the
ManagedFunctiondepending on dependencies of authentication subsequently causing execution by differentTeam. This is especially as the majority ofHttpRequestservicing will use theHttpSessionto cache details and not require the authentication dependencies causing the swap inTeam.- Specified by:
ratifyin interfaceHttpSecurity<HttpAuthentication<java.lang.Void>,HttpAccessControl,java.lang.Void,None,None>- Parameters:
credentials- Credentials.context-RatifyContext.- Returns:
trueshould enough information be available to undertake authentication.falseif not enough information is available for authentication.
-
authenticate
public void authenticate(java.lang.Void credentials, AuthenticateContext<HttpAccessControl,None,None> context) throws HttpExceptionDescription copied from interface:HttpSecurityUndertakes authentication.- Specified by:
authenticatein interfaceHttpSecurity<HttpAuthentication<java.lang.Void>,HttpAccessControl,java.lang.Void,None,None>- Parameters:
credentials- Credentials.context-AuthenticateContext.- Throws:
HttpException- If failure in communicating to necessary security services.
-
challenge
public void challenge(ChallengeContext<None,None> context) throws HttpException
Description copied from interface:HttpSecurityTriggers the authentication challenge to the client.- Specified by:
challengein interfaceHttpSecurity<HttpAuthentication<java.lang.Void>,HttpAccessControl,java.lang.Void,None,None>- Parameters:
context-ChallengeContext.- Throws:
HttpException- If failure in communicating to necessary security services.
-
logout
public void logout(LogoutContext<None,None> context) throws HttpException
Description copied from interface:HttpSecurityLogs out.- Specified by:
logoutin interfaceHttpSecurity<HttpAuthentication<java.lang.Void>,HttpAccessControl,java.lang.Void,None,None>- Parameters:
context-LogoutContext.- Throws:
HttpException- If failure in communicating to necessary security services.
-
isAuthenticated
public boolean isAuthenticated() throws HttpExceptionDescription copied from interface:HttpAuthenticationIndicates if authenticated.- Specified by:
isAuthenticatedin interfaceHttpAuthentication<java.lang.Void>- Returns:
trueif authenticated.- Throws:
HttpException- If authentication has been attempted but there were failures in undertaking authentication.
-
getCredentialsType
public java.lang.Class<java.lang.Void> getCredentialsType()
Description copied from interface:HttpAuthenticationObtains the type of credentials.- Specified by:
getCredentialsTypein interfaceHttpAuthentication<java.lang.Void>- Returns:
- Type of credentials.
-
authenticate
public void authenticate(java.lang.Void credentials, AuthenticateRequest authenticateRequest)Description copied from interface:HttpAuthenticationTriggers to undertake authentication.- Specified by:
authenticatein interfaceHttpAuthentication<java.lang.Void>- Parameters:
credentials- Credentials. May benullif no credentials are required, or they are pulled from theHttpRequest.authenticateRequest-AuthenticateRequest.
-
getAccessControl
public HttpAccessControl getAccessControl()
Description copied from interface:HttpAuthenticationObtains theHttpAccessControl.- Specified by:
getAccessControlin interfaceHttpAuthentication<java.lang.Void>- Returns:
HttpAccessControl.
-
logout
public void logout(LogoutRequest logoutRequest)
Description copied from interface:HttpAuthenticationUndertakes logging out.- Specified by:
logoutin interfaceHttpAuthentication<java.lang.Void>- Parameters:
logoutRequest-LogoutRequest.
-
getAuthenticationScheme
public java.lang.String getAuthenticationScheme()
Description copied from interface:HttpAccessControlObtains the authentication scheme used.- Specified by:
getAuthenticationSchemein interfaceHttpAccessControl- Returns:
- Authentication scheme.
-
getPrincipal
public java.security.Principal getPrincipal()
Description copied from interface:HttpAccessControlObtains thePrincipal.- Specified by:
getPrincipalin interfaceHttpAccessControl- Returns:
Principal.
-
inRole
public boolean inRole(java.lang.String role)
Description copied from interface:HttpAccessControlIndicates if within role.- Specified by:
inRolein interfaceHttpAccessControl- Parameters:
role- Role to check if have access.- Returns:
trueif supports the role.
-
-