Interface UserAccountDataAccessProvider
- All Superinterfaces:
DataAccessProvider,IdentifiableResourceDataAccessProvider<AccountAttributes>
public interface UserAccountDataAccessProvider
extends IdentifiableResourceDataAccessProvider<AccountAttributes>
-
Method Summary
Modifier and TypeMethodDescriptiondefault ResourceAttributes<?>activate(AccountAttributes account) Activate an existing account.create(AccountAttributes account) Create a new account.voidDelete the user account with the given ID.booleandeleteLink(String linkingAccountManager, String localAccountId, String foreignDomainName, String foreignAccountId) Delete a linked account given the local account ID, the foreign domain name and ID.default @Nullable AccountAttributesfromAttributes(@Nullable Iterable<Attribute> attributes) default @Nullable AccountAttributesgetByEmail(String email) Retrieve an account by email.getByEmail(String email, ResourceQuery.AttributesEnumeration attributesEnumeration) Retrieve an account by email.default @Nullable AccountAttributesRetrieve an AccountAttributes object by the ID.default @Nullable ResourceAttributes<?>getById(String id, ResourceQuery.AttributesEnumeration attributesEnumeration) Retrieve an AccountAttributes object by the ID.default @Nullable AccountAttributesgetByPhone(String phone) Retrieve an AccountAttributes by phone number.getByPhone(String phone, ResourceQuery.AttributesEnumeration attributesEnumeration) Retrieve an AccountAttributes by phone number.default @Nullable AccountAttributesgetByUserName(String userName) Retrieve an AccountAttributes object by the userName.getByUserName(String userName, ResourceQuery.AttributesEnumeration attributesEnumeration) Retrieve an AccountAttributes object by the userName.voidlink(String linkingAccountManager, String localAccountId, String foreignDomainName, String foreignUserName) Link a foreign account ID and domain to the given local AccountId.Returns all linked accounts connected to a local account ID.patch(String accountId, AttributeUpdate attributeUpdate, ResourceQuery.AttributesEnumeration attributesEnumeration) Patch an existing account.resolveLink(String linkingAccountManager, String foreignDomainName, String foreignAccountId) Given a foreign domain and ID (example "facebook" and "user-XYZ-123"), return any local account that "owns" the linked account, or null if none was found.update(String accountId, Map<String, Object> updateMap, ResourceQuery.AttributesEnumeration attributesEnumeration) Update an existing account.update(AccountAttributes account, ResourceQuery.AttributesEnumeration attributesEnumeration) Update an existing account.Methods inherited from interface se.curity.identityserver.sdk.datasource.DataAccessProvider
isThreadSafeMethods inherited from interface se.curity.identityserver.sdk.datasource.IdentifiableResourceDataAccessProvider
getAll, getAll
-
Method Details
-
fromAttributes
@Nullable default @Nullable AccountAttributes fromAttributes(@Nullable Iterable<Attribute> attributes) - Specified by:
fromAttributesin interfaceIdentifiableResourceDataAccessProvider<AccountAttributes>
-
getById
Retrieve an AccountAttributes object by the ID.Implementation Note: The default implementation delegates to
getByUserName(String), ie. it makes the assumption that the ID is the username. If that's not the case, this method must be overwritten as appropriate.- Specified by:
getByIdin interfaceIdentifiableResourceDataAccessProvider<AccountAttributes>- Parameters:
id- resource ID- Returns:
- a populated AccountAttributes object or null if not found
-
getById
@Nullable default @Nullable ResourceAttributes<?> getById(String id, ResourceQuery.AttributesEnumeration attributesEnumeration) Retrieve an AccountAttributes object by the ID.Implementation Note: The default implementation delegates to
getByUserName(String), ie. it makes the assumption that the ID is the username. If that's not the case, this method must be overwritten as appropriate.- Parameters:
id- resource IDattributesEnumeration- attributes inclusions or exclusions- Returns:
- a populated AccountAttributes object or null if not found
-
getByUserName
Retrieve an AccountAttributes object by the userName.- Parameters:
userName- user name- Returns:
- a populated AccountAttributes object or null if not found
-
getByUserName
@Nullable @Nullable ResourceAttributes<?> getByUserName(String userName, ResourceQuery.AttributesEnumeration attributesEnumeration) Retrieve an AccountAttributes object by the userName.- Parameters:
userName- user nameattributesEnumeration- attributes inclusions or exclusions- Returns:
- a populated AccountAttributes object or null if not found
-
getByEmail
Retrieve an account by email.- Parameters:
email- email- Returns:
- A populated AccountAttributes object or null if not found
-
getByEmail
@Nullable @Nullable ResourceAttributes<?> getByEmail(String email, ResourceQuery.AttributesEnumeration attributesEnumeration) Retrieve an account by email.- Parameters:
email- emailattributesEnumeration- attributes inclusions or exclusions- Returns:
- A populated AccountAttributes object or null if not found
-
getByPhone
Retrieve an AccountAttributes by phone number.- Parameters:
phone- phone- Returns:
- A populated AccountAttributes object or null if not found
-
getByPhone
@Nullable @Nullable ResourceAttributes<?> getByPhone(String phone, ResourceQuery.AttributesEnumeration attributesEnumeration) Retrieve an AccountAttributes by phone number.- Parameters:
phone- phoneattributesEnumeration- attributes inclusions or exclusions- Returns:
- A populated AccountAttributes object or null if not found
-
create
Create a new account.- Parameters:
account- to create- Returns:
- the account, reflecting it as it is in the database after creation.
-
update
ResourceAttributes<?> update(AccountAttributes account, ResourceQuery.AttributesEnumeration attributesEnumeration) Update an existing account.- Parameters:
account- to updateattributesEnumeration- the enumerated attributes to return in the result- Returns:
- the updated account after the update is performed.
-
update
@Nullable @Nullable ResourceAttributes<?> update(String accountId, Map<String, Object> updateMap, ResourceQuery.AttributesEnumeration attributesEnumeration) Update an existing account.- Parameters:
accountId- ID of account to be updatedupdateMap- map of updatesattributesEnumeration- the enumerated attributes to return in the result- Returns:
- the updated account after the update is performed, or null if no account with such ID exists.
-
patch
@Nullable @Nullable ResourceAttributes<?> patch(String accountId, AttributeUpdate attributeUpdate, ResourceQuery.AttributesEnumeration attributesEnumeration) Patch an existing account.- Parameters:
accountId- ID of account to be updatedattributeUpdate- containing the attributes to patchattributesEnumeration- the enumerated attributes to return in the result- Returns:
- the updated account after the update is performed, or null if no account with such ID exists.
-
activate
Activate an existing account.- Parameters:
account- to activate- Returns:
- the updated account containing ONLY the mandatory attributes
-
link
void link(String linkingAccountManager, String localAccountId, String foreignDomainName, String foreignUserName) Link a foreign account ID and domain to the given local AccountId.Local means the account that resides in the data store of this
DataAccessProvider. Foreign means an account that belongs to some other data store, or user source. This could be another data base, but might as well be a social account ID such as Facebook or Google.- Parameters:
linkingAccountManager- The account manager responsible for linkinglocalAccountId- The account that should host the linkforeignDomainName- The domain of account that should be added as linked to the local accountforeignUserName- The account Id that should be linked to the local account.
-
listLinks
Returns all linked accounts connected to a local account ID.- Parameters:
linkingAccountManager- The account manager used when the link was createdlocalAccountId- The local account ID- Returns:
- A collection of
LinkedAccounts, empty if none exists - Since:
- 3.0.0
-
resolveLink
@Nullable @Nullable AccountAttributes resolveLink(String linkingAccountManager, String foreignDomainName, String foreignAccountId) Given a foreign domain and ID (example "facebook" and "user-XYZ-123"), return any local account that "owns" the linked account, or null if none was found.- Parameters:
linkingAccountManager- The account manager used when the link was createdforeignDomainName- The domain name of the foreign accountforeignAccountId- The ID in the foreign domain- Returns:
- The local
AccountAttributesof the account or null if none exists - Since:
- 3.0.0
-
deleteLink
boolean deleteLink(String linkingAccountManager, String localAccountId, String foreignDomainName, String foreignAccountId) Delete a linked account given the local account ID, the foreign domain name and ID.- Parameters:
linkingAccountManager- The account manager used when the link was createdlocalAccountId- The local account IDforeignDomainName- The foreign domain nameforeignAccountId- The foreign account ID- Returns:
- true if a linked account was found and deleted, false otherwise
- Since:
- 3.0.0
-
delete
Delete the user account with the given ID.- Parameters:
accountId- ID of the account
-