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
CredentialStore
in a similar wayMockChallengeHttpSecuritySource
works.Using this store allows the application to be built with its appropriate
HttpSecuritySource
authentication scheme. This mocks the backingCredentialStore
for development and tests environments to avoid user management. This therefore avoids the need to change the application behaviour between environments (sameHttpSecuritySource
but 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.String
PROPERTY_ALGORITHM
Name of theProperty
for 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.String
getAlgorithm()
Obtains the algorithm used to encrypt credentials within thisCredentialStore
.protected ManagedObject
getManagedObject()
Synchronously obtains theManagedObject
.java.lang.Object
getObject()
Obtains the object being managed.protected void
loadMetaData(AbstractAsyncManagedObjectSource.MetaDataContext<None,None> context)
Overridden to load meta-data.protected void
loadSpecification(AbstractAsyncManagedObjectSource.SpecificationContext context)
Overridden to load specifications.CredentialEntry
retrieveCredentialEntry(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 theProperty
for the algorithm.- See Also:
- Constant Field Values
-
-
Method Detail
-
loadSpecification
protected void loadSpecification(AbstractAsyncManagedObjectSource.SpecificationContext context)
Description copied from class:AbstractAsyncManagedObjectSource
Overridden to load specifications.- Specified by:
loadSpecification
in classAbstractAsyncManagedObjectSource<None,None>
- Parameters:
context
- Specifications.
-
loadMetaData
protected void loadMetaData(AbstractAsyncManagedObjectSource.MetaDataContext<None,None> context) throws java.lang.Exception
Description copied from class:AbstractAsyncManagedObjectSource
Overridden to load meta-data.- Specified by:
loadMetaData
in 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:AbstractManagedObjectSource
Synchronously obtains theManagedObject
.- Specified by:
getManagedObject
in classAbstractManagedObjectSource<None,None>
- Returns:
ManagedObject
.- Throws:
java.lang.Throwable
- If fails to obtain theManagedObject
.
-
getObject
public java.lang.Object getObject() throws java.lang.Throwable
Description copied from interface:ManagedObject
Obtains the object being managed.- Specified by:
getObject
in 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:CredentialStore
Obtains the algorithm used to encrypt credentials within this
CredentialStore
.Should the return be
null
, blank orCredentialStore.NO_ALGORITHM
then the password is considered to be stored in plain text. This is however only useful for theBASIC
authentication scheme due to the nature of the other authentication schemes (such asDIGEST
).It is expected that the credentials for
DIGEST
will be stored as the algorithm applied touserId:realm:password
(as per RFC 2617). This is necessary as the password is never supplied and therefore forDIGEST
this MUST return an algorithm.- Specified by:
getAlgorithm
in interfaceCredentialStore
- Returns:
- Algorithm.
-
retrieveCredentialEntry
public CredentialEntry retrieveCredentialEntry(java.lang.String userId, java.lang.String realm)
Description copied from interface:CredentialStore
Retrieves theCredentialEntry
.- Specified by:
retrieveCredentialEntry
in interfaceCredentialStore
- Parameters:
userId
- User identifier.realm
- Realm. May benull
(especially in the case forBasic
authentication).- Returns:
CredentialEntry
ornull
if noCredentialEntry
exists for parameters.
-
-