Package org.wso2.carbon.user.api
Interface UserStoreManager
public interface UserStoreManager
The interface to read data from a user store.
Implement this interface in your UserStoreManager class and add the class to
the class path. Provide the class name in the configuration file and the
framework will pick the new code that reads user information from the store.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddRememberMe(String userName, String token) Adding a remember me tokenvoidaddRole(String roleName, String[] userList, Permission[] permissions) Adds a role to the system.voidaddRole(String roleName, String[] userList, Permission[] permissions, boolean isSharedRole) Adds a role to the system.voidaddUser(String userName, Object credential, String[] roleList, Map<String, String> claims, String profileName) Add a user to the user storevoidaddUser(String userName, Object credential, String[] roleList, Map<String, String> claims, String profileName, boolean requirePasswordChange) Add a user to the user storebooleanauthenticate(String userName, Object credential) Given the user name and a credential object, the implementation code must validate whether the user is authenticated.voiddeleteRole(String roleName) Delete the role with the given role namevoiddeleteUser(String userName) Delete the user with the given user namevoiddeleteUserClaimValue(String userName, String claimURI, String profileName) Delete a single user claim valuevoiddeleteUserClaimValues(String userName, String[] claims, String profileName) Delete many user claim values.String[]Get all the profile names in the systemProvides the handler to ClaimManager implementation.Get the list of properties required by the User Store Manager, with default valuesString[]Gets a list of hybrid roles Hybrid role contains a set of user names in a read only user store.getPasswordExpirationTime(String username) Gets the password expiration time of a given userString[]getProfileNames(String userName) Get all profile namesgetProperties(Tenant tenant) Gets the properties of the Tenant.String[]getRoleListOfUser(String userName) Get roles of a user.String[]Get all role namesintThis will get the tenant id associated with the user store managerintgetTenantId(String username) This method works only if the tenant is super tenant.getUserClaimValue(String userName, String claim, String profileName) Get user claim value in the profile.Claim[]getUserClaimValues(String userName, String profileName) Get all claim values of the user in the profile.getUserClaimValues(String userName, String[] claims, String profileName) Get user claim values in the profile.intDeprecated.String[]getUserListOfRole(String roleName) booleanisExistingRole(String roleName) Checks whether the role name is in the user storebooleanisExistingRole(String roleName, boolean isShared) Checks whether the role name is in the user storebooleanisExistingUser(String userName) Checks whether the user is in the user storedefault booleanGet whether the userstore is a local userstore.booleanThis method is to check whether multiple profiles are allowed with a particular user-store.booleanChecks whether this realm connects to a read only user storebooleanTo signal whether underlying user store supports SCIM attributes.booleanisValidRememberMeToken(String userName, String token) Checking the validity of the remember me tokenString[]Retrieves a list of user names upto a maximum limitvoidsetUserClaimValue(String userName, String claimURI, String claimValue, String profileName) Set a single user claim valuevoidSet many user claim valuesvoidupdateCredential(String userName, Object newCredential, Object oldCredential) Update the credential/password of the uservoidupdateCredentialByAdmin(String userName, Object newCredential) Update credential/password by the admin of another uservoidupdateRoleListOfUser(String userName, String[] deletedRoles, String[] newRoles) Updates roles of a uservoidupdateRoleName(String roleName, String newRoleName) Update the role name of given rolevoidupdateUserListOfRole(String roleName, String[] deletedUsers, String[] newUsers) Updates users in a Role
-
Method Details
-
authenticate
Given the user name and a credential object, the implementation code must validate whether the user is authenticated.- Parameters:
userName- The user namecredential- The credential of a user- Returns:
- If the value is true the provided credential match with the user name. False is returned for invalid credential, invalid user name and mismatching credential with user name.
- Throws:
UserStoreException- An unexpected exception has occurred
-
listUsers
Retrieves a list of user names upto a maximum limit- Parameters:
filter- The string to filter out usermaxItemLimit- The max item limit. If -1 then system maximum limit will be used. If the given value is greater than the system configured max limit it will be reseted to the system configured max limit.- Returns:
- An array of user names
- Throws:
UserStoreException
-
isExistingUser
Checks whether the user is in the user store- Parameters:
userName- The user name- Returns:
- Returns true if user name is found else returns false.
- Throws:
UserStoreException
-
isExistingRole
Checks whether the role name is in the user store- Parameters:
roleName-- Returns:
- Throws:
UserStoreException
-
isExistingRole
Checks whether the role name is in the user store- Parameters:
roleName-- Returns:
- Throws:
UserStoreException
-
getRoleNames
Get all role names- Returns:
- An array of all role names
- Throws:
UserStoreException
-
getProfileNames
Get all profile names- Parameters:
userName- The user name- Returns:
- An array of profile names the user has.
- Throws:
UserStoreException
-
getRoleListOfUser
Get roles of a user.- Parameters:
userName- The user name- Returns:
- An array of role names that user belongs.
- Throws:
UserStoreException
-
getUserListOfRole
- Throws:
UserStoreException
-
getUserClaimValue
String getUserClaimValue(String userName, String claim, String profileName) throws UserStoreException Get user claim value in the profile.- Parameters:
userName- The user nameclaim- The claim URIprofileName- The profile name, can be null. If null the default profile is considered.- Returns:
- The value
- Throws:
UserStoreException
-
getUserClaimValues
Map<String,String> getUserClaimValues(String userName, String[] claims, String profileName) throws UserStoreException Get user claim values in the profile.- Parameters:
userName- The user nameclaims- The claim URIprofileName- The profile name, can be null. If null the default profile is considered.- Returns:
- A map containing name value pairs
- Throws:
UserStoreException
-
getUserClaimValues
Get all claim values of the user in the profile.- Parameters:
userName- The user nameprofileName- The profile name, can be null. If null the default profile is considered.- Returns:
- An array of claims
- Throws:
UserStoreException
-
getAllProfileNames
Get all the profile names in the system- Returns:
- An array of all profile names
- Throws:
UserStoreException
-
isReadOnly
Checks whether this realm connects to a read only user store- Returns:
- Returns true of the user store is read only. Returns false if the user store allows modifications.
- Throws:
UserStoreException
-
addUser
void addUser(String userName, Object credential, String[] roleList, Map<String, String> claims, String profileName) throws UserStoreExceptionAdd a user to the user store- Parameters:
userName- User name of the usercredential- The credential/password of the userroleList- The roles that user belongsclaims- Properties of the userprofileName- The name of the profile where claims should be added- Throws:
UserStoreException
-
addUser
void addUser(String userName, Object credential, String[] roleList, Map<String, String> claims, String profileName, boolean requirePasswordChange) throws UserStoreExceptionAdd a user to the user store- Parameters:
userName- User name of the usercredential- The credential/password of the userroleList- The roles that user belongsclaims- Properties of the userprofileName- The name of the profile where claims should be addedrequirePasswordChange- Require the password change within next 24 hours- Throws:
UserStoreException
-
updateCredential
void updateCredential(String userName, Object newCredential, Object oldCredential) throws UserStoreException Update the credential/password of the user- Parameters:
userName- The user namenewCredential- The new credential/passwordoldCredential- The old credential/password- Throws:
UserStoreException
-
updateCredentialByAdmin
Update credential/password by the admin of another user- Parameters:
userName- The user namenewCredential- The new credential- Throws:
UserStoreException
-
deleteUser
Delete the user with the given user name- Parameters:
userName- The user name- Throws:
UserStoreException
-
addRole
void addRole(String roleName, String[] userList, Permission[] permissions, boolean isSharedRole) throws UserStoreException Adds a role to the system.- Parameters:
roleName- The role name.userList- the list of the users.permissions- The permissions of the role.isSharedRole- Whether the added role is a shared role or not- Throws:
UserStoreException
-
addRole
void addRole(String roleName, String[] userList, Permission[] permissions) throws UserStoreException Adds a role to the system.- Parameters:
roleName- The role name.userList- the list of the users.permissions- The permissions of the role.isSharedRole- Whether the added role is a shared role or not- Throws:
UserStoreException
-
deleteRole
Delete the role with the given role name- Parameters:
roleName- The role name- Throws:
UserStoreException
-
updateUserListOfRole
void updateUserListOfRole(String roleName, String[] deletedUsers, String[] newUsers) throws UserStoreException Updates users in a Role- Parameters:
roleName- The role name to be updateddeletedUsers- The array of user names to be deletednewUsers- The array of of user names to be added- Throws:
UserStoreException
-
updateRoleListOfUser
void updateRoleListOfUser(String userName, String[] deletedRoles, String[] newRoles) throws UserStoreException Updates roles of a user- Parameters:
userName- The user name of the user where role list is updateddeletedRoles- The array of role names to be addednewRoles- The array of role names to be added- Throws:
UserStoreException
-
setUserClaimValue
void setUserClaimValue(String userName, String claimURI, String claimValue, String profileName) throws UserStoreException Set a single user claim value- Parameters:
userName- The user nameclaimURI- The claim URIclaimValue- The valueprofileName- The profile name, can be null. If null the default profile is considered.- Throws:
UserStoreException
-
setUserClaimValues
void setUserClaimValues(String userName, Map<String, String> claims, String profileName) throws UserStoreExceptionSet many user claim values- Parameters:
userName- The user nameclaims- Map of claim URIs against valuesprofileName- The profile name, can be null. If null the default profile is considered.- Throws:
UserStoreException
-
deleteUserClaimValue
void deleteUserClaimValue(String userName, String claimURI, String profileName) throws UserStoreException Delete a single user claim value- Parameters:
userName- The user nameclaimURI- Name of the claimprofileName- The profile name, can be null. If null the default profile is considered.- Throws:
UserStoreException
-
deleteUserClaimValues
void deleteUserClaimValues(String userName, String[] claims, String profileName) throws UserStoreException Delete many user claim values.- Parameters:
userName- The user nameclaims- URIs of the claims to be deleted.profileName- The profile name, can be null. If null the default profile is considered.- Throws:
UserStoreException
-
getHybridRoles
Gets a list of hybrid roles Hybrid role contains a set of user names in a read only user store.- Returns:
- Throws:
UserStoreException
-
getPasswordExpirationTime
Gets the password expiration time of a given user- Parameters:
username- The user name- Returns:
- The password expiration time
- Throws:
UserStoreException
-
getUserId
Deprecated.Returns the user id if available- Parameters:
username- The user name- Returns:
- Throws:
UserStoreException
-
getTenantId
This method works only if the tenant is super tenant. If the realm is not super tenant's this method should throw exception- Parameters:
username- The user name- Returns:
- Throws:
UserStoreException
-
getTenantId
This will get the tenant id associated with the user store manager- Returns:
- the tenant id of the authorization manager
- Throws:
UserStoreException- if the operation failed
-
getProperties
Gets the properties of the Tenant.- Parameters:
tenant-- Returns:
- Throws:
UserStoreException
-
updateRoleName
Update the role name of given role- Parameters:
roleName-newRoleName-- Throws:
UserStoreException
-
isMultipleProfilesAllowed
boolean isMultipleProfilesAllowed()This method is to check whether multiple profiles are allowed with a particular user-store. For an example, currently, JDBC user store supports multiple profiles and where as ApacheDS does not allow.- Returns:
- boolean
-
addRememberMe
Adding a remember me token- Parameters:
userName- - User nametoken- - The token to be stored- Throws:
UserStoreException
-
isValidRememberMeToken
Checking the validity of the remember me token- Parameters:
userName- TODOtoken- TODO- Returns:
- Throws:
UserStoreException
-
getClaimManager
Provides the handler to ClaimManager implementation.- Returns:
- Throws:
UserStoreException
-
isSCIMEnabled
To signal whether underlying user store supports SCIM attributes.- Returns:
- Throws:
UserStoreException
-
getDefaultUserStoreProperties
Properties getDefaultUserStoreProperties()Get the list of properties required by the User Store Manager, with default values- Returns:
-
isLocalUserStore
default boolean isLocalUserStore()Get whether the userstore is a local userstore. By default, returns true.- Returns:
- true if the userstore is a local userstore.
-