Class OpenIdAuthorizer

    • Field Detail

      • IOTDB_ADMIN_ROLE_NAME

        public static final java.lang.String IOTDB_ADMIN_ROLE_NAME
        See Also:
        Constant Field Values
      • OPENID_USER_PREFIX

        public static final java.lang.String OPENID_USER_PREFIX
        See Also:
        Constant Field Values
    • Constructor Detail

      • OpenIdAuthorizer

        public OpenIdAuthorizer()
                         throws AuthException,
                                com.nimbusds.oauth2.sdk.ParseException,
                                java.io.IOException,
                                java.net.URISyntaxException
        Throws:
        AuthException
        com.nimbusds.oauth2.sdk.ParseException
        java.io.IOException
        java.net.URISyntaxException
      • OpenIdAuthorizer

        public OpenIdAuthorizer​(java.lang.String providerUrl)
                         throws AuthException,
                                java.net.URISyntaxException,
                                com.nimbusds.oauth2.sdk.ParseException,
                                java.io.IOException
        Throws:
        AuthException
        java.net.URISyntaxException
        com.nimbusds.oauth2.sdk.ParseException
        java.io.IOException
    • Method Detail

      • login

        public boolean login​(java.lang.String token,
                             java.lang.String password)
                      throws AuthException
        Description copied from interface: IAuthorizer
        Login for a user.
        Specified by:
        login in interface IAuthorizer
        Overrides:
        login in class BasicAuthorizer
        Parameters:
        token - The username of the user.
        password - The password of the user.
        Returns:
        True if such user exists and the given password is correct, else return false.
        Throws:
        AuthException - if exception raised when searching for the user.
      • getIoTDBUserName

        public java.lang.String getIoTDBUserName​(java.lang.String token)
      • createUser

        public void createUser​(java.lang.String username,
                               java.lang.String password)
        Description copied from interface: IAuthorizer
        Create a user with given username and password. New users will only be granted no privileges.
        Specified by:
        createUser in interface IAuthorizer
        Overrides:
        createUser in class BasicAuthorizer
        Parameters:
        username - is not null or empty
        password - is not null or empty
      • isAdmin

        public boolean isAdmin​(java.lang.String token)
        So not with the token!
        Parameters:
        token - Usually the JWT but could also be just the name of the user.
        Returns:
        true if the user is an admin
      • checkUserPrivileges

        public boolean checkUserPrivileges​(java.lang.String username,
                                           PartialPath path,
                                           int privilegeId)
                                    throws AuthException
        Description copied from interface: IAuthorizer
        Check if the user have the privilege on the seriesPath.
        Specified by:
        checkUserPrivileges in interface IAuthorizer
        Overrides:
        checkUserPrivileges in class BasicAuthorizer
        Parameters:
        username - The name of the user whose privileges are checked.
        path - The seriesPath on which the privilege takes effect. If the privilege is a seriesPath-free privilege, this should be "root".
        privilegeId - An integer that represents a privilege.
        Returns:
        True if the user has such privilege, false if the user does not have such privilege.
        Throws:
        AuthException - If the seriesPath or the privilege is illegal.
      • updateUserPassword

        public void updateUserPassword​(java.lang.String username,
                                       java.lang.String newPassword)
        Description copied from interface: IAuthorizer
        Modify the password of a user.
        Specified by:
        updateUserPassword in interface IAuthorizer
        Overrides:
        updateUserPassword in class BasicAuthorizer
        Parameters:
        username - The user whose password is to be modified.
        newPassword - The new password.