public class SqrlJpaPersistenceProvider extends Object implements SqrlPersistence
SqrlPersistence which uses JPA in order to provide SQL and no-SQL connectivity.
Web apps should not use this class directly, instead SqrlServerOperations should be used
| Modifier and Type | Class and Description |
|---|---|
static class |
SqrlJpaPersistenceProvider.SqrlJpaEntityManagerMonitorTask
A task which periodically checks the state of various
EntityManager instances to ensure they are being
closed properly by the library |
| Modifier and Type | Field and Description |
|---|---|
static String |
PERSISTENCE_UNIT_NAME |
| Constructor and Description |
|---|
SqrlJpaPersistenceProvider()
Deprecated.
do not invoke this constructor directly
|
| Modifier and Type | Method and Description |
|---|---|
void |
cleanUpExpiredEntries()
Delete any expired objects in the persistence store
|
void |
closeCommit()
Commit all updates since this persistence object was created
|
void |
closeRollback()
Ignore all updates since this persistence object was created
|
void |
createAndEnableSqrlIdentity(String sqrlIdk,
Map<String,String> identityDataTable)
Create a new
SqrlIdentity and enable SQRL authentication |
SqrlCorrelator |
createCorrelator(String correlatorString,
Date expiryTime)
Create a new correlator instance in the persistence
|
void |
deleteSqrlCorrelator(SqrlCorrelator sqrlCorrelator) |
void |
deleteSqrlIdentity(String sqrlIdk)
Invoked when the user chooses to remove SQRL authentication for this site
|
boolean |
doesSqrlIdentityExistByIdk(String sqrlIdk)
Check persistence to see if a user exists with the given sqrlIdk
|
SqrlCorrelator |
fetchSqrlCorrelator(String sqrlCorrelatorString)
Fetch the correlator object for the given string value
|
SqrlCorrelator |
fetchSqrlCorrelatorRequired(String sqrlCorrelatorString)
Fetch the correlator object for the given string value, or throw an exception if it does not exist
|
Map<String,SqrlCorrelator> |
fetchSqrlCorrelatorsDetached(Set<String> correlatorStringSet) |
Map<String,SqrlAuthenticationStatus> |
fetchSqrlCorrelatorStatusUpdates(Map<String,SqrlAuthenticationStatus> correlatorToCurrentStatusTable)
Checks for correlators who's status has changed or is
SqrlAuthenticationStatus.AUTH_COMPLETE. |
Boolean |
fetchSqrlFlagForIdentity(String sqrlIdk,
SqrlFlag flagToFetch)
Invoked to determine if SQRL auth is enabled for a user
|
SqrlIdentity |
fetchSqrlIdentityByUserXref(String userXref)
Fetch the sqrl identity for the the given app user cross reference id
|
String |
fetchSqrlIdentityDataItem(String sqrlIdk,
String toFetch)
Request to the data store to retrieve user specific SQRL data that was previously stored via
#userAuthenticatedViaSqrl(String, String, Map) |
String |
fetchTransientAuthData(String correlator,
String dataName)
Fetch a short lived name/value for a given correlator and name
|
boolean |
hasTokenBeenUsed(String nutTokenString)
Check persistence to see if this token has already been used
|
boolean |
isClosed() |
void |
markTokenAsUsed(String nutTokenString,
Date expiryTime)
Mark the given token as used in persistence.
|
void |
setSqrlFlagForIdentity(String sqrlIdk,
SqrlFlag flagToSet,
boolean valueToSet)
Invoked when the user chooses to temporarily disable SQRL authentication for this site
|
void |
storeSqrlDataForSqrlIdentity(String sqrlIdk,
Map<String,String> dataToStore)
Indicates that we have received user specific data from the SQRL client that needs to be stored for the user;
NOTE this is often the first call made for a new SQRL identity, so if the identity does not currently
exist, it must be created
|
void |
updateIdkForSqrlIdentity(String previousSqrlIdk,
String newSqrlIdk)
The user has updated their SQRL ID but this application is still using the old one.
|
void |
updateNativeUserXref(long sqrlIdentityDbId,
String nativeUserXref)
Called to assign a native user cross reference to the given SQRL identity object so when SQRL authentication
takes place, the application knows which user has authenticated
|
void |
userAuthenticatedViaSqrl(String sqrlIdk,
String correlatorString)
Indicates that a user was authenticated successfully via SQRL.
|
public static final String PERSISTENCE_UNIT_NAME
@Deprecated public SqrlJpaPersistenceProvider()
public boolean doesSqrlIdentityExistByIdk(String sqrlIdk)
SqrlPersistencedoesSqrlIdentityExistByIdk in interface SqrlPersistencesqrlIdk - the SQRL ID to check forpublic void updateIdkForSqrlIdentity(String previousSqrlIdk, String newSqrlIdk)
SqrlPersistenceupdateIdkForSqrlIdentity in interface SqrlPersistencepreviousSqrlIdk - the old SQRL ID, which is present in persistencenewSqrlIdk - the new SQRL ID, which should replace previousSqrlIdk in persistencepublic SqrlIdentity fetchSqrlIdentityByUserXref(String userXref)
SqrlPersistencefetchSqrlIdentityByUserXref in interface SqrlPersistenceuserXref - the app user cross reference value to search bypublic void deleteSqrlIdentity(String sqrlIdk)
SqrlPersistencedeleteSqrlIdentity in interface SqrlPersistencesqrlIdk - the SQRL ID which represents the user.public void userAuthenticatedViaSqrl(String sqrlIdk, String correlatorString)
SqrlPersistence
userAuthenticatedViaSqrl in interface SqrlPersistencesqrlIdk - the SQRL ID which the user authenticated with.correlatorString - The correlator ID that was generated when the login page was presented and embedded in the sqrl urlpublic void updateNativeUserXref(long sqrlIdentityDbId,
String nativeUserXref)
SqrlPersistenceupdateNativeUserXref in interface SqrlPersistencesqrlIdentityDbId - the SQRL identity to updatenativeUserXref - the applications native user id for this userpublic SqrlCorrelator fetchSqrlCorrelator(String sqrlCorrelatorString)
SqrlPersistencefetchSqrlCorrelator in interface SqrlPersistencesqrlCorrelatorString - the string value to search forpublic SqrlCorrelator fetchSqrlCorrelatorRequired(String sqrlCorrelatorString)
SqrlPersistencefetchSqrlCorrelatorRequired in interface SqrlPersistencesqrlCorrelatorString - the string value to search forpublic Map<String,SqrlCorrelator> fetchSqrlCorrelatorsDetached(Set<String> correlatorStringSet)
fetchSqrlCorrelatorsDetached in interface SqrlPersistencepublic Map<String,SqrlAuthenticationStatus> fetchSqrlCorrelatorStatusUpdates(Map<String,SqrlAuthenticationStatus> correlatorToCurrentStatusTable)
SqrlPersistenceSqrlAuthenticationStatus.AUTH_COMPLETE. Complete
state is always returned in case the client didn't get the update the first time it was sentfetchSqrlCorrelatorStatusUpdates in interface SqrlPersistencecorrelatorToCurrentStatusTable - table of string correlators and their current state as sent by the browserpublic void storeSqrlDataForSqrlIdentity(String sqrlIdk, Map<String,String> dataToStore)
SqrlPersistencestoreSqrlDataForSqrlIdentity in interface SqrlPersistencesqrlIdk - the SQRL ID which the user authenticated with.dataToStore - SQRL related data that must be persisted for this user and be retreivable via
SqrlPersistence.fetchSqrlIdentityDataItem(String, String)public String fetchSqrlIdentityDataItem(String sqrlIdk, String toFetch)
SqrlPersistence#userAuthenticatedViaSqrl(String, String, Map)
fetchSqrlIdentityDataItem in interface SqrlPersistencesqrlIdk - the SQRL ID which the user authenticated with.toFetch - The name of the SQRL data to be fetched. Was the key in the Map whenpublic boolean hasTokenBeenUsed(String nutTokenString)
SqrlPersistencehasTokenBeenUsed in interface SqrlPersistencenutTokenString - the SqrlNutToken token in sqbase64 format as received from the client the token sent by the
SQRL client in the requestpublic void markTokenAsUsed(String nutTokenString, Date expiryTime)
SqrlPersistence#hasTokenBeenUsed(SqrlNutToken) must return true for this token until expiryTime. Once the expiryTime has
been reached, persistence cleanup can occur and this token can be deleted from persistencemarkTokenAsUsed in interface SqrlPersistencenutTokenString - the SqrlNutToken token in sqbase64 format as received from the clientexpiryTime - the time at which this token can safely be deleted from persistence since it will fail timestamp
validationpublic String fetchTransientAuthData(String correlator, String dataName)
SqrlPersistencefetchTransientAuthData in interface SqrlPersistencecorrelator - correlator to which this data belongspublic void closeCommit()
SqrlPersistencecloseCommit in interface SqrlPersistencepublic void closeRollback()
SqrlPersistencecloseRollback in interface SqrlPersistencepublic Boolean fetchSqrlFlagForIdentity(String sqrlIdk, SqrlFlag flagToFetch)
SqrlPersistencefetchSqrlFlagForIdentity in interface SqrlPersistencesqrlIdk - the SQRL ID which represents the user.SqrlEaabledState#NOT_EXIST if there is nonepublic void setSqrlFlagForIdentity(String sqrlIdk, SqrlFlag flagToSet, boolean valueToSet)
SqrlPersistencesetSqrlFlagForIdentity in interface SqrlPersistencesqrlIdk - the SQRL ID which represents the user.public void createAndEnableSqrlIdentity(String sqrlIdk, Map<String,String> identityDataTable)
SqrlPersistenceSqrlIdentity and enable SQRL authenticationcreateAndEnableSqrlIdentity in interface SqrlPersistencesqrlIdk - the idk of the SQRL identityidentityDataTable - auth data for this SQRL identitypublic SqrlCorrelator createCorrelator(String correlatorString, Date expiryTime)
SqrlPersistencecreateCorrelator in interface SqrlPersistencecorrelatorString - the correlator value stringexpiryTime - the time at which this correlator expirespublic void deleteSqrlCorrelator(SqrlCorrelator sqrlCorrelator)
deleteSqrlCorrelator in interface SqrlPersistencepublic boolean isClosed()
isClosed in interface SqrlPersistencepublic void cleanUpExpiredEntries()
SqrlPersistencecleanUpExpiredEntries in interface SqrlPersistenceCopyright © 2016. All rights reserved.