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 voidauthenticate(C credentials, AuthenticateContext<MockAccessControl,O,F> context)Undertakes authentication.voidchallenge(ChallengeContext<O,F> context)Triggers the authentication challenge to the client.MockAuthenticationcreateAuthentication(AuthenticationContext<MockAccessControl,C> context)Creates the custom authentication.protected voidloadMetaData(AbstractHttpSecuritySource.MetaDataContext<MockAuthentication,MockAccessControl,C,O,F> context)Overridden to load meta-data.protected voidloadSpecification(AbstractHttpSecuritySource.SpecificationContext context)Overridden to load specifications.voidlogout(LogoutContext<O,F> context)Logs out.booleanratify(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:AbstractHttpSecuritySourceOverridden to load specifications.- Specified by:
loadSpecificationin 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:AbstractHttpSecuritySourceOverridden to load meta-data.- Specified by:
loadMetaDatain 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:HttpSecuritySourceSources theHttpSecurity.- Specified by:
sourceHttpSecurityin 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:HttpSecurityCreates the custom authentication.- Specified by:
createAuthenticationin 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: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<MockAuthentication,MockAccessControl,C,O extends java.lang.Enum<O>,F extends java.lang.Enum<F>>- 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(C credentials, AuthenticateContext<MockAccessControl,O,F> context) throws HttpException
Description copied from interface:HttpSecurityUndertakes authentication.- Specified by:
authenticatein 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:HttpSecurityTriggers the authentication challenge to the client.- Specified by:
challengein 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:HttpSecurityLogs out.- Specified by:
logoutin 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.
-
-