Class PasswordFileCredentialStore
- All Implemented Interfaces:
CredentialStore
CredentialStore.- Author:
- Daniel Sagenschneider
-
Field Summary
Fields inherited from interface net.officefloor.web.security.store.CredentialStore
DEFAULT_ALGORITHM, NO_ALGORITHM -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionObtains the algorithm used to encrypt credentials within thisCredentialStore.static PasswordFileloadPasswordFile(File rawFile) Loads thePasswordFilefrom the raw file.retrieveCredentialEntry(String userId, String realm) Retrieves theCredentialEntry.
-
Constructor Details
-
PasswordFileCredentialStore
Initiate.- Parameters:
file-PasswordFile.
-
-
Method Details
-
loadPasswordFile
Loads the
PasswordFilefrom the raw file.The password file must be of the form:
# comment line algorithm=[algorithm] [UserId]:[Credentials]:[Role],[Role]
where items in brackets, [x], should be replaced with appropriate information.
The algorithm must be specified as first data line. Typically the [algorithm] value would be
MD5.The may be many
UserIdentry lines with the user having manyRole's defined separated by commas (,).The binary credentials must be
Base64encoded.- Parameters:
rawFile- Raw file containing the password details.- Returns:
- Populated
PasswordFilefrom the raw file. - Throws:
IOException- If failure reading the passwordFile.
-
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
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.
-