Class MockCredentialStoreManagedObjectSource
- java.lang.Object
-
- net.officefloor.frame.api.managedobject.source.impl.AbstractAsyncManagedObjectSource<O,F>
-
- net.officefloor.frame.api.managedobject.source.impl.AbstractManagedObjectSource<None,None>
-
- net.officefloor.web.security.store.MockCredentialStoreManagedObjectSource
-
- All Implemented Interfaces:
ManagedObject,ManagedObjectSource<None,None>,CredentialStore
public class MockCredentialStoreManagedObjectSource extends AbstractManagedObjectSource<None,None> implements ManagedObject, CredentialStore
Provides mocking of a
CredentialStorein a similar wayMockChallengeHttpSecuritySourceworks.Using this store allows the application to be built with its appropriate
HttpSecuritySourceauthentication scheme. This mocks the backingCredentialStorefor development and tests environments to avoid user management. This therefore avoids the need to change the application behaviour between environments (sameHttpSecuritySourcebut differing configuredCredentialStore).- Author:
- Daniel Sagenschneider
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class net.officefloor.frame.api.managedobject.source.impl.AbstractAsyncManagedObjectSource
AbstractAsyncManagedObjectSource.DependencyLabeller<K extends java.lang.Enum<K>>, AbstractAsyncManagedObjectSource.ExecutionLabeller, AbstractAsyncManagedObjectSource.Labeller<K extends java.lang.Enum<K>>, AbstractAsyncManagedObjectSource.MetaDataContext<O extends java.lang.Enum<O>,F extends java.lang.Enum<F>>, AbstractAsyncManagedObjectSource.SpecificationContext
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringPROPERTY_ALGORITHMName of thePropertyfor the algorithm.-
Fields inherited from interface net.officefloor.web.security.store.CredentialStore
DEFAULT_ALGORITHM, NO_ALGORITHM
-
-
Constructor Summary
Constructors Constructor Description MockCredentialStoreManagedObjectSource()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetAlgorithm()Obtains the algorithm used to encrypt credentials within thisCredentialStore.protected ManagedObjectgetManagedObject()Synchronously obtains theManagedObject.java.lang.ObjectgetObject()Obtains the object being managed.protected voidloadMetaData(AbstractAsyncManagedObjectSource.MetaDataContext<None,None> context)Overridden to load meta-data.protected voidloadSpecification(AbstractAsyncManagedObjectSource.SpecificationContext context)Overridden to load specifications.CredentialEntryretrieveCredentialEntry(java.lang.String userId, java.lang.String realm)Retrieves theCredentialEntry.-
Methods inherited from class net.officefloor.frame.api.managedobject.source.impl.AbstractManagedObjectSource
sourceManagedObject
-
Methods inherited from class net.officefloor.frame.api.managedobject.source.impl.AbstractAsyncManagedObjectSource
getSpecification, init, start, stop
-
-
-
-
Field Detail
-
PROPERTY_ALGORITHM
public static final java.lang.String PROPERTY_ALGORITHM
Name of thePropertyfor the algorithm.- See Also:
- Constant Field Values
-
-
Method Detail
-
loadSpecification
protected void loadSpecification(AbstractAsyncManagedObjectSource.SpecificationContext context)
Description copied from class:AbstractAsyncManagedObjectSourceOverridden to load specifications.- Specified by:
loadSpecificationin classAbstractAsyncManagedObjectSource<None,None>- Parameters:
context- Specifications.
-
loadMetaData
protected void loadMetaData(AbstractAsyncManagedObjectSource.MetaDataContext<None,None> context) throws java.lang.Exception
Description copied from class:AbstractAsyncManagedObjectSourceOverridden to load meta-data.- Specified by:
loadMetaDatain classAbstractAsyncManagedObjectSource<None,None>- Parameters:
context- Meta-data.- Throws:
java.lang.Exception- If fails to load the meta-data.
-
getManagedObject
protected ManagedObject getManagedObject() throws java.lang.Throwable
Description copied from class:AbstractManagedObjectSourceSynchronously obtains theManagedObject.- Specified by:
getManagedObjectin classAbstractManagedObjectSource<None,None>- Returns:
ManagedObject.- Throws:
java.lang.Throwable- If fails to obtain theManagedObject.
-
getObject
public java.lang.Object getObject() throws java.lang.ThrowableDescription copied from interface:ManagedObjectObtains the object being managed.- Specified by:
getObjectin interfaceManagedObject- Returns:
- Object being managed.
- Throws:
java.lang.Throwable- Indicating failed to obtain the object for use.
-
getAlgorithm
public java.lang.String getAlgorithm()
Description copied from interface:CredentialStoreObtains the algorithm used to encrypt credentials within this
CredentialStore.Should the return be
null, blank orCredentialStore.NO_ALGORITHMthen the password is considered to be stored in plain text. This is however only useful for theBASICauthentication scheme due to the nature of the other authentication schemes (such asDIGEST).It is expected that the credentials for
DIGESTwill be stored as the algorithm applied touserId:realm:password(as per RFC 2617). This is necessary as the password is never supplied and therefore forDIGESTthis MUST return an algorithm.- Specified by:
getAlgorithmin interfaceCredentialStore- Returns:
- Algorithm.
-
retrieveCredentialEntry
public CredentialEntry retrieveCredentialEntry(java.lang.String userId, java.lang.String realm)
Description copied from interface:CredentialStoreRetrieves theCredentialEntry.- Specified by:
retrieveCredentialEntryin interfaceCredentialStore- Parameters:
userId- User identifier.realm- Realm. May benull(especially in the case forBasicauthentication).- Returns:
CredentialEntryornullif noCredentialEntryexists for parameters.
-
-