Class LinkIdentityUseCase
java.lang.Object
com.irurueta.authserver.authorization.application.social.LinkIdentityUseCase
Use case that links an identity of an external provider to the account of a signed-in user. Unlike the sign-in, it
does not depend on the e-mail address: the user proved to own the account by being signed in, and the provider by
having just authenticated. The identity is locked first, as the sign-in does, so a concurrent sign-in or link of the
same identity is serialized with it.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ClockSource of the current time.private final FederatedIdentityRepositoryPort that stores the links.private final RecordSecurityEventUseCaseUse case that records the audit events. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionLinks an identity to an account.
-
Field Details
-
federatedIdentityRepository
Port that stores the links. -
recordSecurityEventUseCase
Use case that records the audit events. -
clock
Source of the current time.
-
-
Constructor Details
-
LinkIdentityUseCase
public LinkIdentityUseCase()
-
-
Method Details
-
execute
public FederatedIdentity execute(UUID userId, String username, IdentityProvider provider, String subject, String email) Links an identity to an account. Linking an identity the account already has changes nothing.- Parameters:
userId- identifier of the signed-in user.username- name of the signed-in account, for the audit log.provider- provider that authenticated the user.subject- stable identifier the provider assigned to the user.email- e-mail address the provider reported, ornull.- Returns:
- the link.
- Throws:
FederatedIdentityAlreadyLinkedException- if the identity belongs to another account.
-