java.lang.Object
org.bzdev.ejws.SBLStore
- All Implemented Interfaces:
AutoCloseable
Persistent storage for SBL data and passwords. The constructor
will be given a file. For a file fname in some directory,
files names #fname and fname~ may also be created
and are used to recover if the system goes down unexpectedly.
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidSet the data field for a user.voidSet all fields for a user.voidclose()Close all output streams and terminate subprocesses.booleancontainsUser(String name) Determine if thisSBLStorecontains a user.Get the password for a user.getSBLData(String name) Get SBL data.getUsers(Map<String, ? extends EjwsAuthenticator.Entry> emap, boolean active) Get users.booleanDetermine if a user is in the active state.booleanisGPGEntry(String name) Determine if a user is represented by a GPG entry that indicates if the user is active or pending.booleanDetermine if a user is in the pending state.voidmakeActive(String name) Make a user active.voidmakePending(String name) Make a user pending (that is, not active).Get a stream of entry-set elements whose keys are user names and whose values are the corresponding instance ofSBLStore.Entry.voidremoveUser(String name) Remove a user.
-
Constructor Details
-
SBLStore
Constructor. for a file named "store", files name "#store" and "store~" may be created temporarily.- Parameters:
file- the file used for persistent storage- Throws:
IOException
-
-
Method Details
-
mapStream
Get a stream of entry-set elements whose keys are user names and whose values are the corresponding instance ofSBLStore.Entry.- Returns:
- the stream
-
getUsers
Get users.- Parameters:
active- true if only active users should be included; false if only non-active users should be included- Returns:
- a set of users
-
containsUser
Determine if thisSBLStorecontains a user.- Parameters:
name- the name of the user- Returns:
- true if the user is contained by this store; false otherwise
-
isActive
Determine if a user is in the active state.- Parameters:
name- the name of the user- Returns:
- true if the user is active; false otherwise
-
isPending
Determine if a user is in the pending state.- Parameters:
name- the name of the user- Returns:
- true if the user is pending; false otherwise
-
isGPGEntry
Determine if a user is represented by a GPG entry that indicates if the user is active or pending.- Returns:
- true if the user's entry indicates if the user is active or passive, but does not contain password or SBL data
-
append
Set all fields for a user.- Parameters:
name- the user namepwmode- the password mode (true if the data parameter is an basic-authentication password; false if it is SBL data encoded as a stringdata- the dataisActive- true the user is active; false otherwise- Throws:
IOException
-
append
Set the data field for a user.- Parameters:
name- the user namepwmode- the password mode (true if the data parameter is an basic-authentication password; false if it is SBL data encoded as a stringdata- the data- Throws:
IOException
-
makeActive
Make a user active.- Parameters:
name- the user name- Throws:
IOException
-
makePending
Make a user pending (that is, not active).- Parameters:
name- the user name- Throws:
IOException
-
removeUser
Remove a user.- Parameters:
name- the user name- Throws:
IOException- if an IO error occurs or if there is no entry for the given user name
-
getSBLData
Get SBL data.- Parameters:
name- the name of a user- Returns:
- the
Stringrepresentation of SBL data; null if there is no SBL data
-
getPWData
Get the password for a user.- Parameters:
name- the name of a user- Returns:
- the password; null if a password was not strored
-
close
Close all output streams and terminate subprocesses.- Specified by:
closein interfaceAutoCloseable- Throws:
IOException
-