Interface FederatedIdentityRepository
- All Known Implementing Classes:
JdbcFederatedIdentityRepository
public interface FederatedIdentityRepository
Port that stores the identities of external providers linked to accounts. It never returns
null.-
Method Summary
Modifier and TypeMethodDescriptionlongcountByUser(UUID userId) Counts the identities linked to an account.booleanDeletes a link of an account.findByIdAndUser(UUID id, UUID userId) Finds one link of an account.findByProviderAndSubject(IdentityProvider provider, String subject) Finds the link of a provider's subject.findByUser(UUID userId) Lists the identities linked to an account, oldest link first.voidlockSubject(IdentityProvider provider, String subject) Serializes, until the caller's transaction ends, every caller that links or resolves the same identity of a provider, so that two first sign-ins of the same person never both try to link it: the second one waits and then finds the link of the first.save(FederatedIdentity identity) Stores a link, inserting it or updating the e-mail address and last sign-in instant of an existing one.
-
Method Details
-
lockSubject
Serializes, until the caller's transaction ends, every caller that links or resolves the same identity of a provider, so that two first sign-ins of the same person never both try to link it: the second one waits and then finds the link of the first.- Parameters:
provider- provider that holds the identity.subject- stable identifier the provider assigned to the user.
-
findByProviderAndSubject
Finds the link of a provider's subject.- Parameters:
provider- provider that holds the identity.subject- stable identifier the provider assigned to the user.- Returns:
- the link, or an empty optional when that identity is not linked to any account.
-
findByUser
Lists the identities linked to an account, oldest link first.- Parameters:
userId- identifier of the account.- Returns:
- the links, possibly empty.
-
findByIdAndUser
Finds one link of an account.- Parameters:
id- identifier of the link.userId- identifier of the account, so nobody can reach another account's link.- Returns:
- the link, or an empty optional when the account has no such link.
-
save
Stores a link, inserting it or updating the e-mail address and last sign-in instant of an existing one.- Parameters:
identity- link to store.- Returns:
- the stored link.
-
delete
Deletes a link of an account.- Parameters:
id- identifier of the link.userId- identifier of the account.- Returns:
truewhen a link was deleted.
-
countByUser
Counts the identities linked to an account.- Parameters:
userId- identifier of the account.- Returns:
- the number of links.
-