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
HttpSecurity
enable 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 void
authenticate(java.lang.Void credentials, AuthenticateRequest authenticateRequest)
Triggers to undertake authentication.void
authenticate(java.lang.Void credentials, AuthenticateContext<HttpAccessControl,None,None> context)
Undertakes authentication.void
challenge(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.HttpAccessControl
getAccessControl()
Obtains theHttpAccessControl
.java.lang.String
getAuthenticationScheme()
Obtains the authentication scheme used.java.lang.Class<java.lang.Void>
getCredentialsType()
Obtains the type of credentials.java.security.Principal
getPrincipal()
Obtains thePrincipal
.boolean
inRole(java.lang.String role)
Indicates if within role.boolean
isAuthenticated()
Indicates if authenticated.protected void
loadMetaData(AbstractHttpSecuritySource.MetaDataContext<HttpAuthentication<java.lang.Void>,HttpAccessControl,java.lang.Void,None,None> context)
Overridden to load meta-data.protected void
loadSpecification(AbstractHttpSecuritySource.SpecificationContext context)
Overridden to load specifications.void
logout(LogoutRequest logoutRequest)
Undertakes logging out.void
logout(LogoutContext<None,None> context)
Logs out.boolean
ratify(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:AbstractHttpSecuritySource
Overridden to load specifications.- Specified by:
loadSpecification
in 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:AbstractHttpSecuritySource
Overridden to load meta-data.- Specified by:
loadMetaData
in 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:HttpSecuritySource
Sources theHttpSecurity
.- Specified by:
sourceHttpSecurity
in 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:HttpSecurity
Creates the custom authentication.- Specified by:
createAuthentication
in 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:HttpSecurity
Ratifies 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
ManagedFunction
depending on dependencies of authentication subsequently causing execution by differentTeam
. This is especially as the majority ofHttpRequest
servicing will use theHttpSession
to cache details and not require the authentication dependencies causing the swap inTeam
.- Specified by:
ratify
in interfaceHttpSecurity<HttpAuthentication<java.lang.Void>,HttpAccessControl,java.lang.Void,None,None>
- Parameters:
credentials
- Credentials.context
-RatifyContext
.- Returns:
true
should enough information be available to undertake authentication.false
if not enough information is available for authentication.
-
authenticate
public void authenticate(java.lang.Void credentials, AuthenticateContext<HttpAccessControl,None,None> context) throws HttpException
Description copied from interface:HttpSecurity
Undertakes authentication.- Specified by:
authenticate
in 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:HttpSecurity
Triggers the authentication challenge to the client.- Specified by:
challenge
in 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:HttpSecurity
Logs out.- Specified by:
logout
in 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 HttpException
Description copied from interface:HttpAuthentication
Indicates if authenticated.- Specified by:
isAuthenticated
in interfaceHttpAuthentication<java.lang.Void>
- Returns:
true
if 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:HttpAuthentication
Obtains the type of credentials.- Specified by:
getCredentialsType
in interfaceHttpAuthentication<java.lang.Void>
- Returns:
- Type of credentials.
-
authenticate
public void authenticate(java.lang.Void credentials, AuthenticateRequest authenticateRequest)
Description copied from interface:HttpAuthentication
Triggers to undertake authentication.- Specified by:
authenticate
in interfaceHttpAuthentication<java.lang.Void>
- Parameters:
credentials
- Credentials. May benull
if no credentials are required, or they are pulled from theHttpRequest
.authenticateRequest
-AuthenticateRequest
.
-
getAccessControl
public HttpAccessControl getAccessControl()
Description copied from interface:HttpAuthentication
Obtains theHttpAccessControl
.- Specified by:
getAccessControl
in interfaceHttpAuthentication<java.lang.Void>
- Returns:
HttpAccessControl
.
-
logout
public void logout(LogoutRequest logoutRequest)
Description copied from interface:HttpAuthentication
Undertakes logging out.- Specified by:
logout
in interfaceHttpAuthentication<java.lang.Void>
- Parameters:
logoutRequest
-LogoutRequest
.
-
getAuthenticationScheme
public java.lang.String getAuthenticationScheme()
Description copied from interface:HttpAccessControl
Obtains the authentication scheme used.- Specified by:
getAuthenticationScheme
in interfaceHttpAccessControl
- Returns:
- Authentication scheme.
-
getPrincipal
public java.security.Principal getPrincipal()
Description copied from interface:HttpAccessControl
Obtains thePrincipal
.- Specified by:
getPrincipal
in interfaceHttpAccessControl
- Returns:
Principal
.
-
inRole
public boolean inRole(java.lang.String role)
Description copied from interface:HttpAccessControl
Indicates if within role.- Specified by:
inRole
in interfaceHttpAccessControl
- Parameters:
role
- Role to check if have access.- Returns:
true
if supports the role.
-
-