Class AbstractMockHttpSecuritySource<C,O extends java.lang.Enum<O>,F extends java.lang.Enum<F>>
- java.lang.Object
-
- net.officefloor.web.spi.security.impl.AbstractHttpSecuritySource<MockAuthentication,MockAccessControl,C,O,F>
-
- net.officefloor.web.security.scheme.AbstractMockHttpSecuritySource<C,O,F>
-
- All Implemented Interfaces:
HttpSecurity<MockAuthentication,MockAccessControl,C,O,F>
,HttpSecuritySource<MockAuthentication,MockAccessControl,C,O,F>
@TestSource public class AbstractMockHttpSecuritySource<C,O extends java.lang.Enum<O>,F extends java.lang.Enum<F>> extends AbstractHttpSecuritySource<MockAuthentication,MockAccessControl,C,O,F> implements HttpSecurity<MockAuthentication,MockAccessControl,C,O,F>
Abstract mockHttpSecuritySource
.- Author:
- Daniel Sagenschneider
-
-
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 AbstractMockHttpSecuritySource()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
authenticate(C credentials, AuthenticateContext<MockAccessControl,O,F> context)
Undertakes authentication.void
challenge(ChallengeContext<O,F> context)
Triggers the authentication challenge to the client.MockAuthentication
createAuthentication(AuthenticationContext<MockAccessControl,C> context)
Creates the custom authentication.protected void
loadMetaData(AbstractHttpSecuritySource.MetaDataContext<MockAuthentication,MockAccessControl,C,O,F> context)
Overridden to load meta-data.protected void
loadSpecification(AbstractHttpSecuritySource.SpecificationContext context)
Overridden to load specifications.void
logout(LogoutContext<O,F> context)
Logs out.boolean
ratify(C credentials, RatifyContext<MockAccessControl> context)
Ratifies whether enough information is available to undertake authentication.HttpSecurity<MockAuthentication,MockAccessControl,C,O,F>
sourceHttpSecurity(HttpSecurityContext context)
Sources theHttpSecurity
.-
Methods inherited from class net.officefloor.web.spi.security.impl.AbstractHttpSecuritySource
getSpecification, init, start, stop
-
-
-
-
Method Detail
-
loadSpecification
protected void loadSpecification(AbstractHttpSecuritySource.SpecificationContext context)
Description copied from class:AbstractHttpSecuritySource
Overridden to load specifications.- Specified by:
loadSpecification
in classAbstractHttpSecuritySource<MockAuthentication,MockAccessControl,C,O extends java.lang.Enum<O>,F extends java.lang.Enum<F>>
- Parameters:
context
- Specifications.
-
loadMetaData
protected void loadMetaData(AbstractHttpSecuritySource.MetaDataContext<MockAuthentication,MockAccessControl,C,O,F> context) throws java.lang.Exception
Description copied from class:AbstractHttpSecuritySource
Overridden to load meta-data.- Specified by:
loadMetaData
in classAbstractHttpSecuritySource<MockAuthentication,MockAccessControl,C,O extends java.lang.Enum<O>,F extends java.lang.Enum<F>>
- Parameters:
context
- Meta-data.- Throws:
java.lang.Exception
- If fails to load the meta-data.
-
sourceHttpSecurity
public HttpSecurity<MockAuthentication,MockAccessControl,C,O,F> sourceHttpSecurity(HttpSecurityContext context) throws HttpException
Description copied from interface:HttpSecuritySource
Sources theHttpSecurity
.- Specified by:
sourceHttpSecurity
in interfaceHttpSecuritySource<MockAuthentication,MockAccessControl,C,O extends java.lang.Enum<O>,F extends java.lang.Enum<F>>
- Parameters:
context
-HttpSecurity
.- Returns:
HttpSecurity
.- Throws:
HttpException
- If fails to source theHttpSecurity
.
-
createAuthentication
public MockAuthentication createAuthentication(AuthenticationContext<MockAccessControl,C> context)
Description copied from interface:HttpSecurity
Creates the custom authentication.- Specified by:
createAuthentication
in interfaceHttpSecurity<MockAuthentication,MockAccessControl,C,O extends java.lang.Enum<O>,F extends java.lang.Enum<F>>
- Parameters:
context
-AuthenticateContext
.- Returns:
- Custom authentication.
-
ratify
public boolean ratify(C credentials, RatifyContext<MockAccessControl> 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<MockAuthentication,MockAccessControl,C,O extends java.lang.Enum<O>,F extends java.lang.Enum<F>>
- 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(C credentials, AuthenticateContext<MockAccessControl,O,F> context) throws HttpException
Description copied from interface:HttpSecurity
Undertakes authentication.- Specified by:
authenticate
in interfaceHttpSecurity<MockAuthentication,MockAccessControl,C,O extends java.lang.Enum<O>,F extends java.lang.Enum<F>>
- Parameters:
credentials
- Credentials.context
-AuthenticateContext
.- Throws:
HttpException
- If failure in communicating to necessary security services.
-
challenge
public void challenge(ChallengeContext<O,F> context) throws HttpException
Description copied from interface:HttpSecurity
Triggers the authentication challenge to the client.- Specified by:
challenge
in interfaceHttpSecurity<MockAuthentication,MockAccessControl,C,O extends java.lang.Enum<O>,F extends java.lang.Enum<F>>
- Parameters:
context
-ChallengeContext
.- Throws:
HttpException
- If failure in communicating to necessary security services.
-
logout
public void logout(LogoutContext<O,F> context) throws HttpException
Description copied from interface:HttpSecurity
Logs out.- Specified by:
logout
in interfaceHttpSecurity<MockAuthentication,MockAccessControl,C,O extends java.lang.Enum<O>,F extends java.lang.Enum<F>>
- Parameters:
context
-LogoutContext
.- Throws:
HttpException
- If failure in communicating to necessary security services.
-
-