Package com.google.gerrit.server.account
Class AccountManager
java.lang.Object
com.google.gerrit.server.account.AccountManager
Tracks authentication related details for user accounts.
-
Constructor Summary
ConstructorsConstructorDescriptionAccountManager
(Sequences sequences, org.eclipse.jgit.lib.Config cfg, Accounts accounts, com.google.inject.Provider<AccountsUpdate> accountsUpdateProvider, AccountCache byIdCache, Realm accountMapper, IdentifiedUser.GenericFactory userFactory, SshKeyCache sshKeyCache, ProjectCache projectCache, ExternalIds externalIds, GroupsUpdate.Factory groupsUpdateFactory, SetInactiveFlag setInactiveFlag, ExternalIdFactory externalIdFactory, ExternalIdKeyFactory externalIdKeyFactory) -
Method Summary
Modifier and TypeMethodDescriptionauthenticate
(AuthRequest who) Authenticate the user, potentially creating a new account if they are new.link
(Account.Id to, AuthRequest who) Link another authentication identity to an existing account.Returns a user identified by this external identity stringvoid
unlink
(Account.Id from, ExternalId.Key extIdKey) Unlink an external identity from an existing account.void
unlink
(Account.Id from, Collection<ExternalId.Key> extIdKeys) Unlink an external identities from an existing account.updateLink
(Account.Id to, AuthRequest who) Update the link to another unique authentication identity to an existing account.
-
Constructor Details
-
AccountManager
@Inject public AccountManager(Sequences sequences, org.eclipse.jgit.lib.Config cfg, Accounts accounts, com.google.inject.Provider<AccountsUpdate> accountsUpdateProvider, AccountCache byIdCache, Realm accountMapper, IdentifiedUser.GenericFactory userFactory, SshKeyCache sshKeyCache, ProjectCache projectCache, ExternalIds externalIds, GroupsUpdate.Factory groupsUpdateFactory, SetInactiveFlag setInactiveFlag, ExternalIdFactory externalIdFactory, ExternalIdKeyFactory externalIdKeyFactory)
-
-
Method Details
-
lookup
Returns a user identified by this external identity string- Throws:
AccountException
-
authenticate
@CanIgnoreReturnValue public AuthResult authenticate(AuthRequest who) throws AccountException, IOException Authenticate the user, potentially creating a new account if they are new.- Parameters:
who
- identity of the user, with any details we received about them.- Returns:
- the result of authenticating the user.
- Throws:
AccountException
- the account does not exist, and cannot be created, or exists, but cannot be located, is unable to be activated or deactivated, or is inactive, or cannot be added to the admin group (only for the first account).IOException
-
link
@CanIgnoreReturnValue public AuthResult link(Account.Id to, AuthRequest who) throws AccountException, IOException, org.eclipse.jgit.errors.ConfigInvalidException Link another authentication identity to an existing account.- Parameters:
to
- account to link the identity onto.who
- the additional identity.- Returns:
- the result of linking the identity to the user.
- Throws:
AccountException
- the identity belongs to a different account, or it cannot be linked at this time.IOException
org.eclipse.jgit.errors.ConfigInvalidException
-
updateLink
@CanIgnoreReturnValue public AuthResult updateLink(Account.Id to, AuthRequest who) throws AccountException, IOException, org.eclipse.jgit.errors.ConfigInvalidException Update the link to another unique authentication identity to an existing account.Existing external identities with the same scheme will be removed and replaced with the new one.
- Parameters:
to
- account to link the identity onto.who
- the additional identity.- Returns:
- the result of linking the identity to the user.
- Throws:
AccountException
- the identity belongs to a different account, or it cannot be linked at this time.IOException
org.eclipse.jgit.errors.ConfigInvalidException
-
unlink
public void unlink(Account.Id from, ExternalId.Key extIdKey) throws AccountException, IOException, org.eclipse.jgit.errors.ConfigInvalidException Unlink an external identity from an existing account.- Parameters:
from
- account to unlink the external identity fromextIdKey
- the key of the external ID that should be deleted- Throws:
AccountException
- the identity belongs to a different account, or the identity was not foundIOException
org.eclipse.jgit.errors.ConfigInvalidException
-
unlink
public void unlink(Account.Id from, Collection<ExternalId.Key> extIdKeys) throws AccountException, IOException, org.eclipse.jgit.errors.ConfigInvalidException Unlink an external identities from an existing account.- Parameters:
from
- account to unlink the external identity fromextIdKeys
- the keys of the external IDs that should be deleted- Throws:
AccountException
- any of the identity belongs to a different account, or any of the identity was not foundIOException
org.eclipse.jgit.errors.ConfigInvalidException
-