Package org.apache.iotdb.db.auth
Class AuthorizerManager
- java.lang.Object
-
- org.apache.iotdb.db.auth.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
-
-
Constructor Summary
Constructors Constructor Description AuthorizerManager()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbuildTSBlock(java.util.Map<java.lang.String,java.util.List<java.lang.String>> authorizerInfo, com.google.common.util.concurrent.SettableFuture<ConfigTaskResult> future)build TSBlockorg.apache.iotdb.common.rpc.thrift.TSStatuscheckPath(java.lang.String username, java.util.List<java.lang.String> allPath, int permission)Check the pathorg.apache.iotdb.common.rpc.thrift.TSStatuscheckUser(java.lang.String username, java.lang.String password)Check the userbooleancheckUserPrivileges(java.lang.String username, java.lang.String path, int privilegeId)voidcreateRole(java.lang.String roleName)voidcreateUser(java.lang.String username, java.lang.String password)voiddeleteRole(java.lang.String roleName)voiddeleteUser(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 AuthorizerManagergetInstance()java.util.Set<java.lang.Integer>getPrivileges(java.lang.String username, java.lang.String path)org.apache.iotdb.commons.auth.entity.RolegetRole(java.lang.String roleName)org.apache.iotdb.commons.auth.entity.UsergetUser(java.lang.String username)voidgrantPrivilegeToRole(java.lang.String roleName, java.lang.String path, int privilegeId)voidgrantPrivilegeToUser(java.lang.String username, java.lang.String path, int privilegeId)voidgrantRoleToUser(java.lang.String roleName, java.lang.String username)booleaninvalidateCache(java.lang.String username, java.lang.String roleName)booleanisUserUseWaterMark(java.lang.String userName)java.util.List<java.lang.String>listAllRoles()java.util.List<java.lang.String>listAllUsers()booleanlogin(java.lang.String username, java.lang.String password)com.google.common.util.concurrent.SettableFuture<ConfigTaskResult>operatePermission(AuthorStatement authorStatement)voidprocessLoadSnapshot(java.io.File snapshotDir)booleanprocessTakeSnapshot(java.io.File snapshotDir)com.google.common.util.concurrent.SettableFuture<ConfigTaskResult>queryPermission(AuthorStatement authorStatement)voidreplaceAllRoles(java.util.Map<java.lang.String,org.apache.iotdb.commons.auth.entity.Role> roles)voidreplaceAllUsers(java.util.Map<java.lang.String,org.apache.iotdb.commons.auth.entity.User> users)voidreset()voidrevokePrivilegeFromRole(java.lang.String roleName, java.lang.String path, int privilegeId)voidrevokePrivilegeFromUser(java.lang.String username, java.lang.String path, int privilegeId)voidrevokeRoleFromUser(java.lang.String roleName, java.lang.String username)voidsetUserUseWaterMark(java.lang.String userName, boolean useWaterMark)voidupdateUserPassword(java.lang.String username, java.lang.String newPassword)
-
-
-
Method Detail
-
getInstance
public static AuthorizerManager getInstance()
-
login
public boolean login(java.lang.String username, java.lang.String password) throws org.apache.iotdb.commons.auth.AuthException- Specified by:
loginin interfaceorg.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:
createUserin interfaceorg.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:
deleteUserin interfaceorg.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:
grantPrivilegeToUserin interfaceorg.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:
revokePrivilegeFromUserin interfaceorg.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:
createRolein interfaceorg.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:
deleteRolein interfaceorg.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:
grantPrivilegeToRolein interfaceorg.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:
revokePrivilegeFromRolein interfaceorg.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:
grantRoleToUserin interfaceorg.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:
revokeRoleFromUserin interfaceorg.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:
getPrivilegesin interfaceorg.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:
updateUserPasswordin interfaceorg.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:
checkUserPrivilegesin interfaceorg.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:
resetin interfaceorg.apache.iotdb.commons.auth.authorizer.IAuthorizer- Throws:
org.apache.iotdb.commons.auth.AuthException
-
listAllUsers
public java.util.List<java.lang.String> listAllUsers()
- Specified by:
listAllUsersin interfaceorg.apache.iotdb.commons.auth.authorizer.IAuthorizer
-
listAllRoles
public java.util.List<java.lang.String> listAllRoles()
- Specified by:
listAllRolesin interfaceorg.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:
getRolein interfaceorg.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:
getUserin interfaceorg.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:
isUserUseWaterMarkin interfaceorg.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:
setUserUseWaterMarkin interfaceorg.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:
getAllUserWaterMarkStatusin interfaceorg.apache.iotdb.commons.auth.authorizer.IAuthorizer
-
getAllUsers
public java.util.Map<java.lang.String,org.apache.iotdb.commons.auth.entity.User> getAllUsers()
- Specified by:
getAllUsersin interfaceorg.apache.iotdb.commons.auth.authorizer.IAuthorizer
-
getAllRoles
public java.util.Map<java.lang.String,org.apache.iotdb.commons.auth.entity.Role> getAllRoles()
- Specified by:
getAllRolesin interfaceorg.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:
replaceAllUsersin interfaceorg.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:
replaceAllRolesin interfaceorg.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:
processTakeSnapshotin interfaceorg.apache.iotdb.commons.snapshot.SnapshotProcessor- Throws:
org.apache.thrift.TExceptionjava.io.IOException
-
processLoadSnapshot
public void processLoadSnapshot(java.io.File snapshotDir) throws org.apache.thrift.TException, java.io.IOException- Specified by:
processLoadSnapshotin interfaceorg.apache.iotdb.commons.snapshot.SnapshotProcessor- Throws:
org.apache.thrift.TExceptionjava.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.ConfigNodeConnectionExceptionCheck the user- Throws:
org.apache.iotdb.rpc.ConfigNodeConnectionException
-
invalidateCache
public boolean invalidateCache(java.lang.String username, java.lang.String roleName)
-
queryPermission
public com.google.common.util.concurrent.SettableFuture<ConfigTaskResult> queryPermission(AuthorStatement authorStatement)
-
operatePermission
public com.google.common.util.concurrent.SettableFuture<ConfigTaskResult> operatePermission(AuthorStatement authorStatement)
-
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
-
-