Class CommonJsonIdentity

    • Method Detail

      • initializeIdentity

        public static org.json.JSONObject initializeIdentity()
      • getId

        public String getId()
        Description copied from interface: Identity
        Get the unique id for this user
        Specified by:
        getId in interface Identity
        Returns:
        a unique ID
      • setApiKeyUsedForAuth

        public void setApiKeyUsedForAuth​(String apiKey)
      • getApiKey

        public String getApiKey()
        Get the API key supplied to the constructor, if any.
        Returns:
        an API key or null
      • asJson

        public org.json.JSONObject asJson()
      • setPassword

        public void setPassword​(String password)
                         throws IamSvcException
        Description copied from interface: Identity
        Set the user's password. Implementations of this interface should be careful to store the password indirectly (e.g. via salted hash), but this is not enforced at the interface layer.
        Specified by:
        setPassword in interface Identity
        Parameters:
        password - a password
        Throws:
        IamSvcException - when the call cannot be completed due to a service error
      • requestPasswordReset

        public String requestPasswordReset​(long secondsUntilExpire,
                                           String nonce)
                                    throws IamSvcException,
                                           IamBadRequestException
        Description copied from interface: Identity
        Request a password reset. The response is a unique tag that would normally be distributed to the user via email as a link. The user acknowledges the password change request by clicking the link. The link handler then calls completePasswordReset().
        Specified by:
        requestPasswordReset in interface Identity
        Parameters:
        secondsUntilExpire - amount of time until the generated tag expires
        nonce - arbitrary user data used to create the tag
        Returns:
        a unique tag
        Throws:
        IamSvcException - when the call cannot be completed due to a service error
        IamIdentityDoesNotExist - when the identity doesn't exist
        IamBadRequestException - when the request is now allowed
      • deleteApiKey

        public void deleteApiKey​(ApiKey key)
                          throws IamSvcException
        Description copied from interface: Identity
        Delete an API key from the user.
        Specified by:
        deleteApiKey in interface Identity
        Parameters:
        key - the API key to remove
        Throws:
        IamSvcException - when the call cannot be completed due to a service error
      • enable

        public void enable​(boolean enable)
                    throws IamSvcException
        Description copied from interface: Identity
        Enable or disable the user. When disabled, authentication will fail.
        Specified by:
        enable in interface Identity
        Parameters:
        enable - if true, enable the user
        Throws:
        IamSvcException - when the call cannot be completed due to a service error
      • isEnabled

        public boolean isEnabled()
        Description copied from interface: Identity
        Is this identity enabled?
        Specified by:
        isEnabled in interface Identity
        Returns:
        true if enabled
      • getPasswordSalt

        public String getPasswordSalt()
      • getPasswordHash

        public String getPasswordHash()
      • getGroup

        public Group getGroup​(String groupId)
                       throws IamSvcException
        Description copied from interface: Identity
        Get a group by ID if the user is a member. Otherwise, null is returned.
        Specified by:
        getGroup in interface Identity
        Parameters:
        groupId - the ID of the group to retrieve
        Returns:
        a group or null if not a member
        Throws:
        IamSvcException - when the call cannot be completed due to a service error
      • addApiKey

        public void addApiKey​(String newApiKey)
      • addGroup

        protected boolean addGroup​(String groupId)
      • removeGroup

        protected boolean removeGroup​(String groupId)
      • main

        public static void main​(String[] args)