Class AccountManager


  • public class AccountManager
    extends Object
    Tracks authentication related details for user accounts.
    • Method Detail

      • authenticate

        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

        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

        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 from
        extIdKey - the key of the external ID that should be deleted
        Throws:
        AccountException - the identity belongs to a different account, or the identity was not found
        IOException
        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 from
        extIdKeys - 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 found
        IOException
        org.eclipse.jgit.errors.ConfigInvalidException