Class CILSQLUserStore
- java.lang.Object
-
- edu.uiuc.ncsa.security.storage.sql.SQLDatabase
-
- edu.uiuc.ncsa.security.storage.sql.SQLStore<V>
-
- edu.uiuc.ncsa.security.storage.monitored.MonitoredSQLStore<User>
-
- org.cilogon.oauth2.servlet.storage.user.CILSQLUserStore
-
- All Implemented Interfaces:
edu.uiuc.ncsa.security.core.Store<User>,edu.uiuc.ncsa.security.storage.MonitoredStoreInterface<User>,Map<edu.uiuc.ncsa.security.core.Identifier,User>,UserStore
public class CILSQLUserStore extends edu.uiuc.ncsa.security.storage.monitored.MonitoredSQLStore<User> implements UserStore
Created by Jeff Gaynor
on Mar 12, 2010 at 3:41:37 PM
-
-
Constructor Summary
Constructors Constructor Description CILSQLUserStore(edu.uiuc.ncsa.security.storage.sql.ConnectionPool connectionPool, edu.uiuc.ncsa.security.storage.sql.internals.Table table, edu.uiuc.ncsa.security.core.util.IdentifiableProviderImpl<User> idp, edu.uiuc.ncsa.security.storage.data.MapConverter converter, Incrementable incrementable)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Usercreate()Usercreate(boolean newSerialString)Create a user, optionally with a new serial string.UsercreateAndRegisterUser(UserMultiID userMultiKey, String idP, String idPDisplayName, String firstName, String lastName, String email, String affiliation, String displayName, String organizationalUnit)Create a user from all the given possible information.Set<Map.Entry<edu.uiuc.ncsa.security.core.Identifier,User>>entrySet()Userget(Object o)API-specific.Userget(String remoteUser, String idP)API-specific get by remoteUser and IDP.Collection<User>get(UserMultiID userMultiKey, String idP)Get the user using theUserMultiIDand entity ID (aka IDP).StringgetCreationTSField()IncrementablegetIncrementable()edu.uiuc.ncsa.security.storage.data.MapConvertergetMapConverter()edu.uiuc.ncsa.security.core.IdentifiergetUserID(String userKey, String personName, String idP)edu.uiuc.ncsa.security.core.IdentifiergetUserID(EduPersonPrincipleName eppn, String idP)edu.uiuc.ncsa.security.core.IdentifiergetUserID(EduPersonTargetedID eptid, String idP)edu.uiuc.ncsa.security.core.IdentifiergetUserID(OpenID openID, String idP)edu.uiuc.ncsa.security.core.IdentifiergetUserID(RemoteUserName remoteUser, String idP)edu.uiuc.ncsa.security.core.IdentifiergetUserID(UserMultiID userMultiKey, String idP)Resolves the user id given the remoteUser and IdP.protected UserProvidergetUserProvider()UserTablegetUserTable()booleanremove(String remoteUser, String idP)protected StringselectSnippet(PersonName personName, String key)This will find the name from the PersonName and, if there is one, return an SQL snippet of the formkey=?to be added to the select statement.voidupdate(User user)Update the user.voidupdateCheckSerialString(User user, boolean keepSerialID)Save the current user but do not change the serial identifier.-
Methods inherited from class edu.uiuc.ncsa.security.storage.monitored.MonitoredSQLStore
addLastAccessedEventListener, doUpkeep, doUpkeep, fireLastAccessedEvent, gatherStats, getKeys, getLastAccessedEventListeners, getMostRecent, getUpkeepConfiguration, getUuid, hasUpkeepConfiguration, isMonitorEnabled, lastAccessUpdate, setMonitorEnabled, setUpkeepConfiguration, updateHook
-
Methods inherited from class edu.uiuc.ncsa.security.storage.sql.SQLStore
checkColumns, checkTable, clear, containsKey, containsValue, crappySQLParser, crappySQLParser, depopulate, doRegisterStatement, getAll, getDerbyMostRecent, getMostRecentStatement, getTable, getXMLConverter, isEmpty, keySet, populate, put, putAll, register, remove, remove, removeByID, save, search, search, search, search, setUpdateValues, size, size, size, toString, update, update, values
-
Methods inherited from class edu.uiuc.ncsa.security.storage.sql.SQLDatabase
destroyConnection, getConnection, getConnectionPool, releaseConnection, rsToMap, setConnectionPool
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Map
clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, equals, forEach, getOrDefault, hashCode, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
-
-
-
-
Constructor Detail
-
CILSQLUserStore
public CILSQLUserStore(edu.uiuc.ncsa.security.storage.sql.ConnectionPool connectionPool, edu.uiuc.ncsa.security.storage.sql.internals.Table table, edu.uiuc.ncsa.security.core.util.IdentifiableProviderImpl<User> idp, edu.uiuc.ncsa.security.storage.data.MapConverter converter, Incrementable incrementable)
-
-
Method Detail
-
getIncrementable
public Incrementable getIncrementable()
- Specified by:
getIncrementablein interfaceUserStore
-
createAndRegisterUser
public User createAndRegisterUser(UserMultiID userMultiKey, String idP, String idPDisplayName, String firstName, String lastName, String email, String affiliation, String displayName, String organizationalUnit)
Description copied from interface:UserStoreCreate a user from all the given possible information. Some of this might be missing, but the minimal set is the remoteUser and idp. Note that this creates the user uid too AND it registers the user.- Specified by:
createAndRegisterUserin interfaceUserStore- Returns:
-
selectSnippet
protected String selectSnippet(PersonName personName, String key)
This will find the name from the PersonName and, if there is one, return an SQL snippet of the formkey=?to be added to the select statement.- Parameters:
personName-key-- Returns:
-
get
public Collection<User> get(UserMultiID userMultiKey, String idP)
Get the user using theUserMultiIDand entity ID (aka IDP). This returns a match if at least one of the IDs matches.
-
getUserID
public edu.uiuc.ncsa.security.core.Identifier getUserID(UserMultiID userMultiKey, String idP)
Description copied from interface:UserStoreResolves the user id given the remoteUser and IdP.
-
getUserProvider
protected UserProvider getUserProvider()
-
getUserTable
public UserTable getUserTable()
-
create
public User create(boolean newSerialString)
Description copied from interface:UserStoreCreate a user, optionally with a new serial string. The default behavior for this store is that new users are not created with a new serial identifier (or various operations such as listing users can run through a great many unused identifiers and if they are expensive to create, such as from an SQL database, this might slow down the application noticeably.)
-
create
public User create()
-
get
public User get(String remoteUser, String idP)
API-specific get by remoteUser and IDP.- Parameters:
remoteUser-idP-- Returns:
-
update
public void update(User user)
Update the user. NOTE: it is up to the programmer to archive the user prior to making any updates, if that is warranted.This updates the serial string!! If you do not want the serial string updated, you should useupdateCheckSerialString(User, boolean)(User, boolean)} with the second argument oftrue. Also,SQLStore.save(Identifiable)will update the user if it exists but is a synonym for
updateCheckSerialString(user, true);
since the store itself has no logic for checking if the user should change. That is the programmer's responsibility. TheAbstractDBServicecontains the logic for that. The aim of these calls are low level operations that do exactly what is required without adding logic.
-
updateCheckSerialString
public void updateCheckSerialString(User user, boolean keepSerialID)
Description copied from interface:UserStoreSave the current user but do not change the serial identifier. Note that this circumvents the contract forStore.update(edu.uiuc.ncsa.security.core.Identifiable)for this interface, which, because of issue CIL-69 requires it in most cases. This is in effect an internal call that allows for administrative updates. IfnoNewSerialID = false, then the effect is the same as callingStore.update(Identifiable)and a new serial id is created.- Specified by:
updateCheckSerialStringin interfaceUserStore
-
getUserID
public edu.uiuc.ncsa.security.core.Identifier getUserID(String userKey, String personName, String idP)
-
getUserID
public edu.uiuc.ncsa.security.core.Identifier getUserID(RemoteUserName remoteUser, String idP)
-
getUserID
public edu.uiuc.ncsa.security.core.Identifier getUserID(EduPersonPrincipleName eppn, String idP)
-
getUserID
public edu.uiuc.ncsa.security.core.Identifier getUserID(EduPersonTargetedID eptid, String idP)
-
getMapConverter
public edu.uiuc.ncsa.security.storage.data.MapConverter getMapConverter()
- Specified by:
getMapConverterin interfaceUserStore- Overrides:
getMapConverterin classedu.uiuc.ncsa.security.storage.sql.SQLStore<User>
-
-