Class UnlinkIdentityUseCase
java.lang.Object
com.irurueta.authserver.authorization.application.social.UnlinkIdentityUseCase
Use case that unlinks an identity of an external provider from an account and audits it. It refuses to remove the
last way to sign in: the account must keep a password its owner knows, another linked identity, a passkey or a bound
certificate. The methods are counted under the lock of
LockSignInMethodsUseCase, so a concurrent removal
(another identity, a certificate) of the same account waits and then counts what this one left.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final FederatedIdentityRepositoryPort that stores the links.private final FederatedLinkingPolicyRules of linking and unlinking.private final LockSignInMethodsUseCaseLocks and counts the sign-in methods of the account.private final RecordSecurityEventUseCaseUse case that records the audit events. -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
federatedIdentityRepository
Port that stores the links. -
lockSignInMethodsUseCase
Locks and counts the sign-in methods of the account. -
federatedLinkingPolicy
Rules of linking and unlinking. -
recordSecurityEventUseCase
Use case that records the audit events.
-
-
Constructor Details
-
UnlinkIdentityUseCase
public UnlinkIdentityUseCase()
-
-
Method Details
-
execute
Unlinks an identity; an identity of another account is never touched.- Parameters:
userId- identifier of the signed-in user.username- name of the signed-in account, for the audit log.id- identifier of the link.- Throws:
FederatedIdentityNotFoundException- if the account has no such link.LastSignInMethodException- if the link is the last way the account can sign in.
-