Class HttpSecurityLoaderUtil
- java.lang.Object
-
- net.officefloor.web.security.type.HttpSecurityLoaderUtil
-
public class HttpSecurityLoaderUtil extends java.lang.ObjectUtility class for testing theHttpSecuritySource.- Author:
- Daniel Sagenschneider
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <C> voidauthenticate(HttpAuthentication<C> authentication, C credentials)Undertakes authentication.static <AC extends java.io.Serializable,C>
AuthenticationContext<AC,C>createAuthenticationContext(ServerHttpConnection connection, HttpSecurity<?,AC,C,?,?> security, java.util.function.Consumer<FunctionAuthenticateContext<AC,C>> handleAuthenticate)Creates anAuthenticationContextfor testing.static HttpSecurityTypeBuildercreateHttpSecurityTypeBuilder()Creates theHttpSecurityTypeBuilderto create the expectedHttpSecurityType.static <A,AC extends java.io.Serializable,C,O extends java.lang.Enum<O>,F extends java.lang.Enum<F>,HS extends HttpSecuritySource<A,AC,C,O,F>>
HttpSecurity<A,AC,C,O,F>loadHttpSecurity(java.lang.Class<HS> httpSecuritySourceClass, java.lang.String... propertyNameValues)Convenience method to load theHttpSecurityinitialised ready for testing.static <A,AC extends java.io.Serializable,C,O extends java.lang.Enum<O>,F extends java.lang.Enum<F>,HS extends HttpSecuritySource<A,AC,C,O,F>>
HSloadHttpSecuritySource(java.lang.Class<HS> httpSecuritySourceClass, java.lang.String... propertyNameValues)Convenience method to load theHttpSecuritySourceinitialised ready for testing.static <A,AC extends java.io.Serializable,C,O extends java.lang.Enum<O>,F extends java.lang.Enum<F>>
HttpSecurityType<A,AC,C,O,F>loadHttpSecurityType(HttpSecuritySource<A,AC,C,O,F> httpSecuritySource, java.lang.String... propertyNameValues)Loads theHttpSecurityType.static <C> voidlogout(HttpAuthentication<C> authentication)Undertakes logout.static <A,AC extends java.io.Serializable,C,O extends java.lang.Enum<O>,F extends java.lang.Enum<F>,HS extends HttpSecuritySource<A,AC,C,O,F>>
HSnewHttpSecuritySource(java.lang.Class<HS> httpSecuritySourceClass)Instantiates and instance of theHttpSecuritySource.static <A,AC extends java.io.Serializable,C,O extends java.lang.Enum<O>,F extends java.lang.Enum<F>,HS extends HttpSecuritySource<A,AC,C,O,F>>
HttpSecurityType<A,AC,C,O,F>validateHttpSecurityType(HttpSecurityTypeBuilder expectedHttpSecurityType, java.lang.Class<HS> httpSecuritySourceClass, java.lang.String... propertyNameValues)Validates theHttpSecurityTypecontained in theHttpSecurityTypeBuilderagainst theHttpSecurityTypeloaded from theHttpSecuritySource.static <A,AC extends java.io.Serializable,C,O extends java.lang.Enum<O>,F extends java.lang.Enum<F>,HS extends HttpSecuritySource<A,AC,C,O,F>>
PropertyListvalidateSpecification(java.lang.Class<HS> httpSecuritySourceClass, java.lang.String... propertyNameLabels)Validates theHttpSecuritySourceSpecificationfor theHttpSecuritySource.
-
-
-
Method Detail
-
validateSpecification
public static <A,AC extends java.io.Serializable,C,O extends java.lang.Enum<O>,F extends java.lang.Enum<F>,HS extends HttpSecuritySource<A,AC,C,O,F>> PropertyList validateSpecification(java.lang.Class<HS> httpSecuritySourceClass, java.lang.String... propertyNameLabels)
Validates theHttpSecuritySourceSpecificationfor theHttpSecuritySource.- Type Parameters:
A- Authentication type.AC- Access control type.C- Credentials type.O- Dependency keys type.F-Flowkeys type.HS-HttpSecuritySourcetype.- Parameters:
httpSecuritySourceClass-HttpSecuritySourceclass.propertyNameLabels- Listing of name/label pairs for thePropertyinstances.- Returns:
- Loaded
PropertyList.
-
createHttpSecurityTypeBuilder
public static HttpSecurityTypeBuilder createHttpSecurityTypeBuilder()
Creates theHttpSecurityTypeBuilderto create the expectedHttpSecurityType.- Returns:
HttpSecurityTypeBuilder.
-
validateHttpSecurityType
public static <A,AC extends java.io.Serializable,C,O extends java.lang.Enum<O>,F extends java.lang.Enum<F>,HS extends HttpSecuritySource<A,AC,C,O,F>> HttpSecurityType<A,AC,C,O,F> validateHttpSecurityType(HttpSecurityTypeBuilder expectedHttpSecurityType, java.lang.Class<HS> httpSecuritySourceClass, java.lang.String... propertyNameValues)
Validates theHttpSecurityTypecontained in theHttpSecurityTypeBuilderagainst theHttpSecurityTypeloaded from theHttpSecuritySource.- Type Parameters:
A- Authentication type.AC- Access control type.C- Credentials type.O- Dependency keys type.F-Flowkeys type.HS-HttpSecuritySourcetype.- Parameters:
expectedHttpSecurityType-HttpSecurityTypeBuilder.httpSecuritySourceClass-HttpSecuritySourceclass.propertyNameValues-Propertyname/value pairs.- Returns:
- Validated
HttpSecurityType.
-
loadHttpSecuritySource
public static <A,AC extends java.io.Serializable,C,O extends java.lang.Enum<O>,F extends java.lang.Enum<F>,HS extends HttpSecuritySource<A,AC,C,O,F>> HS loadHttpSecuritySource(java.lang.Class<HS> httpSecuritySourceClass, java.lang.String... propertyNameValues)
Convenience method to load theHttpSecuritySourceinitialised ready for testing.- Type Parameters:
A- Authentication type.AC- Access control type.C- Credentials type.O- Dependency keys type.F-Flowkeys type.HS-HttpSecuritySourcetype.- Parameters:
httpSecuritySourceClass-HttpSecuritySourceclass.propertyNameValues-Propertyname/value pairs to initialise theHttpSecuritySource.- Returns:
- Initialised
HttpSecuritySource.
-
loadHttpSecurity
public static <A,AC extends java.io.Serializable,C,O extends java.lang.Enum<O>,F extends java.lang.Enum<F>,HS extends HttpSecuritySource<A,AC,C,O,F>> HttpSecurity<A,AC,C,O,F> loadHttpSecurity(java.lang.Class<HS> httpSecuritySourceClass, java.lang.String... propertyNameValues)
Convenience method to load theHttpSecurityinitialised ready for testing.- Type Parameters:
A- Authentication type.AC- Access control type.C- Credentials type.O- Dependency keys type.F-Flowkeys type.HS-HttpSecuritySourcetype.- Parameters:
httpSecuritySourceClass-HttpSecuritySourceclass.propertyNameValues-Propertyname/value pairs to initialise theHttpSecuritySource.- Returns:
- Initialised
HttpSecuritySource.
-
newHttpSecuritySource
public static <A,AC extends java.io.Serializable,C,O extends java.lang.Enum<O>,F extends java.lang.Enum<F>,HS extends HttpSecuritySource<A,AC,C,O,F>> HS newHttpSecuritySource(java.lang.Class<HS> httpSecuritySourceClass)
Instantiates and instance of theHttpSecuritySource.- Type Parameters:
A- Authentication type.AC- Access control type.C- Credentials type.O- Dependency keys type.F-Flowkeys type.HS-HttpSecuritySourcetype.- Parameters:
httpSecuritySourceClass-HttpSecuritySourceclass.- Returns:
- New
HttpSecuritySourceinstance.
-
loadHttpSecurityType
public static <A,AC extends java.io.Serializable,C,O extends java.lang.Enum<O>,F extends java.lang.Enum<F>> HttpSecurityType<A,AC,C,O,F> loadHttpSecurityType(HttpSecuritySource<A,AC,C,O,F> httpSecuritySource, java.lang.String... propertyNameValues)
Loads theHttpSecurityType.- Type Parameters:
A- Authentication type.AC- Access control type.C- Credentials type.O- Dependency keys type.F-Flowkeys type.- Parameters:
httpSecuritySource-HttpSecuritySource.propertyNameValues-Propertyname/value pairs.- Returns:
HttpSecurityType.
-
createAuthenticationContext
public static <AC extends java.io.Serializable,C> AuthenticationContext<AC,C> createAuthenticationContext(ServerHttpConnection connection, HttpSecurity<?,AC,C,?,?> security, java.util.function.Consumer<FunctionAuthenticateContext<AC,C>> handleAuthenticate) throws java.lang.Throwable
Creates anAuthenticationContextfor testing.- Parameters:
connection-ServerHttpConnection.security-HttpSecurity.handleAuthenticate- Handles the authentication.- Returns:
AuthenticationContextfor testing.- Throws:
java.lang.Exception- If fails to create theAuthenticationContext.java.lang.Throwable
-
authenticate
public static <C> void authenticate(HttpAuthentication<C> authentication, C credentials) throws java.lang.Throwable
Undertakes authentication.- Parameters:
authentication-HttpAuthentication.credentials- Credentials.- Throws:
java.lang.Throwable- If fails to authenticate or times out authenticating.
-
logout
public static <C> void logout(HttpAuthentication<C> authentication) throws java.lang.Throwable
Undertakes logout.- Parameters:
authentication-HttpAuthentication.- Throws:
java.lang.Throwable- If fails to logout or times out.
-
-