Class AuthorizerManager

  • All Implemented Interfaces:
    org.apache.iotdb.commons.auth.authorizer.IAuthorizer, org.apache.iotdb.commons.snapshot.SnapshotProcessor

    public class AuthorizerManager
    extends java.lang.Object
    implements org.apache.iotdb.commons.auth.authorizer.IAuthorizer
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void buildTSBlock​(java.util.Map<java.lang.String,​java.util.List<java.lang.String>> authorizerInfo, com.google.common.util.concurrent.SettableFuture<ConfigTaskResult> future)
      build TSBlock
      org.apache.iotdb.common.rpc.thrift.TSStatus checkPath​(java.lang.String username, java.util.List<java.lang.String> allPath, int permission)
      Check the path
      org.apache.iotdb.common.rpc.thrift.TSStatus checkUser​(java.lang.String username, java.lang.String password)
      Check the user
      boolean checkUserPrivileges​(java.lang.String username, java.lang.String path, int privilegeId)  
      void createRole​(java.lang.String roleName)  
      void createUser​(java.lang.String username, java.lang.String password)  
      void deleteRole​(java.lang.String roleName)  
      void deleteUser​(java.lang.String username)  
      java.util.Map<java.lang.String,​org.apache.iotdb.commons.auth.entity.Role> getAllRoles()  
      java.util.Map<java.lang.String,​org.apache.iotdb.commons.auth.entity.User> getAllUsers()  
      java.util.Map<java.lang.String,​java.lang.Boolean> getAllUserWaterMarkStatus()  
      static AuthorizerManager getInstance()  
      java.util.Set<java.lang.Integer> getPrivileges​(java.lang.String username, java.lang.String path)  
      org.apache.iotdb.commons.auth.entity.Role getRole​(java.lang.String roleName)  
      org.apache.iotdb.commons.auth.entity.User getUser​(java.lang.String username)  
      void grantPrivilegeToRole​(java.lang.String roleName, java.lang.String path, int privilegeId)  
      void grantPrivilegeToUser​(java.lang.String username, java.lang.String path, int privilegeId)  
      void grantRoleToUser​(java.lang.String roleName, java.lang.String username)  
      boolean invalidateCache​(java.lang.String username, java.lang.String roleName)  
      boolean isUserUseWaterMark​(java.lang.String userName)  
      java.util.List<java.lang.String> listAllRoles()  
      java.util.List<java.lang.String> listAllUsers()  
      boolean login​(java.lang.String username, java.lang.String password)  
      com.google.common.util.concurrent.SettableFuture<ConfigTaskResult> operatePermission​(AuthorStatement authorStatement)  
      void processLoadSnapshot​(java.io.File snapshotDir)  
      boolean processTakeSnapshot​(java.io.File snapshotDir)  
      com.google.common.util.concurrent.SettableFuture<ConfigTaskResult> queryPermission​(AuthorStatement authorStatement)  
      void replaceAllRoles​(java.util.Map<java.lang.String,​org.apache.iotdb.commons.auth.entity.Role> roles)  
      void replaceAllUsers​(java.util.Map<java.lang.String,​org.apache.iotdb.commons.auth.entity.User> users)  
      void reset()  
      void revokePrivilegeFromRole​(java.lang.String roleName, java.lang.String path, int privilegeId)  
      void revokePrivilegeFromUser​(java.lang.String username, java.lang.String path, int privilegeId)  
      void revokeRoleFromUser​(java.lang.String roleName, java.lang.String username)  
      void setUserUseWaterMark​(java.lang.String userName, boolean useWaterMark)  
      void updateUserPassword​(java.lang.String username, java.lang.String newPassword)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AuthorizerManager

        public AuthorizerManager()
    • Method Detail

      • login

        public boolean login​(java.lang.String username,
                             java.lang.String password)
                      throws org.apache.iotdb.commons.auth.AuthException
        Specified by:
        login in interface org.apache.iotdb.commons.auth.authorizer.IAuthorizer
        Throws:
        org.apache.iotdb.commons.auth.AuthException
      • createUser

        public void createUser​(java.lang.String username,
                               java.lang.String password)
                        throws org.apache.iotdb.commons.auth.AuthException
        Specified by:
        createUser in interface org.apache.iotdb.commons.auth.authorizer.IAuthorizer
        Throws:
        org.apache.iotdb.commons.auth.AuthException
      • deleteUser

        public void deleteUser​(java.lang.String username)
                        throws org.apache.iotdb.commons.auth.AuthException
        Specified by:
        deleteUser in interface org.apache.iotdb.commons.auth.authorizer.IAuthorizer
        Throws:
        org.apache.iotdb.commons.auth.AuthException
      • grantPrivilegeToUser

        public void grantPrivilegeToUser​(java.lang.String username,
                                         java.lang.String path,
                                         int privilegeId)
                                  throws org.apache.iotdb.commons.auth.AuthException
        Specified by:
        grantPrivilegeToUser in interface org.apache.iotdb.commons.auth.authorizer.IAuthorizer
        Throws:
        org.apache.iotdb.commons.auth.AuthException
      • revokePrivilegeFromUser

        public void revokePrivilegeFromUser​(java.lang.String username,
                                            java.lang.String path,
                                            int privilegeId)
                                     throws org.apache.iotdb.commons.auth.AuthException
        Specified by:
        revokePrivilegeFromUser in interface org.apache.iotdb.commons.auth.authorizer.IAuthorizer
        Throws:
        org.apache.iotdb.commons.auth.AuthException
      • createRole

        public void createRole​(java.lang.String roleName)
                        throws org.apache.iotdb.commons.auth.AuthException
        Specified by:
        createRole in interface org.apache.iotdb.commons.auth.authorizer.IAuthorizer
        Throws:
        org.apache.iotdb.commons.auth.AuthException
      • deleteRole

        public void deleteRole​(java.lang.String roleName)
                        throws org.apache.iotdb.commons.auth.AuthException
        Specified by:
        deleteRole in interface org.apache.iotdb.commons.auth.authorizer.IAuthorizer
        Throws:
        org.apache.iotdb.commons.auth.AuthException
      • grantPrivilegeToRole

        public void grantPrivilegeToRole​(java.lang.String roleName,
                                         java.lang.String path,
                                         int privilegeId)
                                  throws org.apache.iotdb.commons.auth.AuthException
        Specified by:
        grantPrivilegeToRole in interface org.apache.iotdb.commons.auth.authorizer.IAuthorizer
        Throws:
        org.apache.iotdb.commons.auth.AuthException
      • revokePrivilegeFromRole

        public void revokePrivilegeFromRole​(java.lang.String roleName,
                                            java.lang.String path,
                                            int privilegeId)
                                     throws org.apache.iotdb.commons.auth.AuthException
        Specified by:
        revokePrivilegeFromRole in interface org.apache.iotdb.commons.auth.authorizer.IAuthorizer
        Throws:
        org.apache.iotdb.commons.auth.AuthException
      • grantRoleToUser

        public void grantRoleToUser​(java.lang.String roleName,
                                    java.lang.String username)
                             throws org.apache.iotdb.commons.auth.AuthException
        Specified by:
        grantRoleToUser in interface org.apache.iotdb.commons.auth.authorizer.IAuthorizer
        Throws:
        org.apache.iotdb.commons.auth.AuthException
      • revokeRoleFromUser

        public void revokeRoleFromUser​(java.lang.String roleName,
                                       java.lang.String username)
                                throws org.apache.iotdb.commons.auth.AuthException
        Specified by:
        revokeRoleFromUser in interface org.apache.iotdb.commons.auth.authorizer.IAuthorizer
        Throws:
        org.apache.iotdb.commons.auth.AuthException
      • getPrivileges

        public java.util.Set<java.lang.Integer> getPrivileges​(java.lang.String username,
                                                              java.lang.String path)
                                                       throws org.apache.iotdb.commons.auth.AuthException
        Specified by:
        getPrivileges in interface org.apache.iotdb.commons.auth.authorizer.IAuthorizer
        Throws:
        org.apache.iotdb.commons.auth.AuthException
      • updateUserPassword

        public void updateUserPassword​(java.lang.String username,
                                       java.lang.String newPassword)
                                throws org.apache.iotdb.commons.auth.AuthException
        Specified by:
        updateUserPassword in interface org.apache.iotdb.commons.auth.authorizer.IAuthorizer
        Throws:
        org.apache.iotdb.commons.auth.AuthException
      • checkUserPrivileges

        public boolean checkUserPrivileges​(java.lang.String username,
                                           java.lang.String path,
                                           int privilegeId)
                                    throws org.apache.iotdb.commons.auth.AuthException
        Specified by:
        checkUserPrivileges in interface org.apache.iotdb.commons.auth.authorizer.IAuthorizer
        Throws:
        org.apache.iotdb.commons.auth.AuthException
      • reset

        public void reset()
                   throws org.apache.iotdb.commons.auth.AuthException
        Specified by:
        reset in interface org.apache.iotdb.commons.auth.authorizer.IAuthorizer
        Throws:
        org.apache.iotdb.commons.auth.AuthException
      • listAllUsers

        public java.util.List<java.lang.String> listAllUsers()
        Specified by:
        listAllUsers in interface org.apache.iotdb.commons.auth.authorizer.IAuthorizer
      • listAllRoles

        public java.util.List<java.lang.String> listAllRoles()
        Specified by:
        listAllRoles in interface org.apache.iotdb.commons.auth.authorizer.IAuthorizer
      • getRole

        public org.apache.iotdb.commons.auth.entity.Role getRole​(java.lang.String roleName)
                                                          throws org.apache.iotdb.commons.auth.AuthException
        Specified by:
        getRole in interface org.apache.iotdb.commons.auth.authorizer.IAuthorizer
        Throws:
        org.apache.iotdb.commons.auth.AuthException
      • getUser

        public org.apache.iotdb.commons.auth.entity.User getUser​(java.lang.String username)
                                                          throws org.apache.iotdb.commons.auth.AuthException
        Specified by:
        getUser in interface org.apache.iotdb.commons.auth.authorizer.IAuthorizer
        Throws:
        org.apache.iotdb.commons.auth.AuthException
      • isUserUseWaterMark

        public boolean isUserUseWaterMark​(java.lang.String userName)
                                   throws org.apache.iotdb.commons.auth.AuthException
        Specified by:
        isUserUseWaterMark in interface org.apache.iotdb.commons.auth.authorizer.IAuthorizer
        Throws:
        org.apache.iotdb.commons.auth.AuthException
      • setUserUseWaterMark

        public void setUserUseWaterMark​(java.lang.String userName,
                                        boolean useWaterMark)
                                 throws org.apache.iotdb.commons.auth.AuthException
        Specified by:
        setUserUseWaterMark in interface org.apache.iotdb.commons.auth.authorizer.IAuthorizer
        Throws:
        org.apache.iotdb.commons.auth.AuthException
      • getAllUserWaterMarkStatus

        public java.util.Map<java.lang.String,​java.lang.Boolean> getAllUserWaterMarkStatus()
        Specified by:
        getAllUserWaterMarkStatus in interface org.apache.iotdb.commons.auth.authorizer.IAuthorizer
      • getAllUsers

        public java.util.Map<java.lang.String,​org.apache.iotdb.commons.auth.entity.User> getAllUsers()
        Specified by:
        getAllUsers in interface org.apache.iotdb.commons.auth.authorizer.IAuthorizer
      • getAllRoles

        public java.util.Map<java.lang.String,​org.apache.iotdb.commons.auth.entity.Role> getAllRoles()
        Specified by:
        getAllRoles in interface org.apache.iotdb.commons.auth.authorizer.IAuthorizer
      • replaceAllUsers

        public void replaceAllUsers​(java.util.Map<java.lang.String,​org.apache.iotdb.commons.auth.entity.User> users)
                             throws org.apache.iotdb.commons.auth.AuthException
        Specified by:
        replaceAllUsers in interface org.apache.iotdb.commons.auth.authorizer.IAuthorizer
        Throws:
        org.apache.iotdb.commons.auth.AuthException
      • replaceAllRoles

        public void replaceAllRoles​(java.util.Map<java.lang.String,​org.apache.iotdb.commons.auth.entity.Role> roles)
                             throws org.apache.iotdb.commons.auth.AuthException
        Specified by:
        replaceAllRoles in interface org.apache.iotdb.commons.auth.authorizer.IAuthorizer
        Throws:
        org.apache.iotdb.commons.auth.AuthException
      • processTakeSnapshot

        public boolean processTakeSnapshot​(java.io.File snapshotDir)
                                    throws org.apache.thrift.TException,
                                           java.io.IOException
        Specified by:
        processTakeSnapshot in interface org.apache.iotdb.commons.snapshot.SnapshotProcessor
        Throws:
        org.apache.thrift.TException
        java.io.IOException
      • processLoadSnapshot

        public void processLoadSnapshot​(java.io.File snapshotDir)
                                 throws org.apache.thrift.TException,
                                        java.io.IOException
        Specified by:
        processLoadSnapshot in interface org.apache.iotdb.commons.snapshot.SnapshotProcessor
        Throws:
        org.apache.thrift.TException
        java.io.IOException
      • checkPath

        public org.apache.iotdb.common.rpc.thrift.TSStatus checkPath​(java.lang.String username,
                                                                     java.util.List<java.lang.String> allPath,
                                                                     int permission)
        Check the path
      • checkUser

        public org.apache.iotdb.common.rpc.thrift.TSStatus checkUser​(java.lang.String username,
                                                                     java.lang.String password)
                                                              throws org.apache.iotdb.rpc.ConfigNodeConnectionException
        Check the user
        Throws:
        org.apache.iotdb.rpc.ConfigNodeConnectionException
      • invalidateCache

        public boolean invalidateCache​(java.lang.String username,
                                       java.lang.String roleName)
      • buildTSBlock

        public void buildTSBlock​(java.util.Map<java.lang.String,​java.util.List<java.lang.String>> authorizerInfo,
                                 com.google.common.util.concurrent.SettableFuture<ConfigTaskResult> future)
        build TSBlock