Package com.openkm.sdk4j.definition
Interface BaseAuth
- All Known Implementing Classes:
AuthImpl
public interface BaseAuth
BaseAuth
- Author:
- jllort
-
Method Summary
Modifier and TypeMethodDescriptionvoidassignRole(String userId, String roleId) Method to assign a rolevoidchangeSecurity(String uuid, ChangeSecurity changeSecurity) Change several security permissions in the same call.createPersonalAccessToken(String name, Calendar expiration) Create personal access tokenvoidcreateRole(String roleId, boolean active) Method to create a new rolevoidcreateUser(String userId, String password, String email, String name, boolean active) Method to create a new uservoiddeleteRole(String roleId) Method to create a delete a rolevoiddeleteUser(String userId) Method to delete a userDisable 2FAGenerate 2FA secretgetGrantedRoles(String uuid) Get roles permissions from am item (document or folder).getGrantedUsers(String uuid) Get user permissions from am item (document or folder).Get granted users and rolesgetProfiles(boolean filterByActive) Get all profilesgetRoles(boolean showAll) Retrieves a list of repository roles.getRolesByUser(String userId) Retrieves a list of roles by user.Get sessiongetTwoFactorQR(String secret) Get 2FARetrieve information of a given usergetUserProfile(String userId) Get user profilegetUsers(boolean showAll) Retrieve information of a given usergetUsersByRole(String roleId) Retrieves a list of users by role.Get a list of available tenants for a user.getUserToken(String userId) Get user tokenvoidGrant role permissions for a node.voidAdd user permissions to a node.booleanIs login lowercasebooleanIs two factor authenticationvoidoverwriteSecurity(String uuid, ChangeSecurity changeSecurity) Change several security permissions in the same call.voidremoveRole(String userId, String roleId) Method to remove a rolevoidrevokeRole(String uuid, String roleId, int permissions, boolean recursive) Revoke role permissions from a node.voidrevokeUser(String uuid, String userId, int permissions, boolean recursive) Revoke user permissions from a node.voidsetRolePermissions(String uuid, String roleId, int permissions, boolean recursive) Set role permissions for a node.voidsetUserPermissions(String uuid, String userId, int permissions, boolean recursive) Set user permissions to a nodevoidsetUserProfile(String userId, long profileId) Set the user profilevoidsetUserTenant(long tenantId) Update user tenant.voidupdateRole(String roleId, boolean active) Update role informationvoidupdateUser(String userId, String password, String email, String name, boolean active) Update user informationvalidate2FAAndSaveSecret(String secret, int code) Validate 2FA and save secretverify2FACode(int code) Verify 2FA code
-
Method Details
-
getSessionId
String getSessionId()Get session- Returns:
- String session id
-
getGrantedUsersAndRoles
GrantedUsersAndRolesItem getGrantedUsersAndRoles(String uuid) throws AccessDeniedException, RepositoryException, DatabaseException, PathNotFoundException, UnknownException, WebserviceException Get granted users and roles- Parameters:
uuid- Node uuid.- Returns:
- GrantedUsersAndRolesItem An object with list the users and roles
- Throws:
AccessDeniedException- the access denied exceptionRepositoryException- the repository exceptionDatabaseException- the database exceptionPathNotFoundException- the path not found exceptionUnknownException- the unknown exceptionWebserviceException- the webservice exception
-
getGrantedRoles
Map<String,Integer> getGrantedRoles(String uuid) throws AccessDeniedException, RepositoryException, DatabaseException, PathNotFoundException, UnknownException, WebserviceException Get roles permissions from am item (document or folder).- Parameters:
uuid- Node uuid.- Returns:
- Map<String, Integer> A hashmap with pairs of role / permissions.
- Throws:
AccessDeniedException- the access denied exceptionRepositoryException- the repository exceptionDatabaseException- the database exceptionPathNotFoundException- the path not found exceptionUnknownException- the unknown exceptionWebserviceException- the webservice exception
-
getGrantedUsers
Map<String,Integer> getGrantedUsers(String uuid) throws AccessDeniedException, RepositoryException, DatabaseException, PathNotFoundException, UnknownException, WebserviceException Get user permissions from am item (document or folder).- Parameters:
uuid- Node uuid.- Returns:
- Map<String, Integer> A hashmap with pairs of user / permissions.
- Throws:
AccessDeniedException- the access denied exceptionRepositoryException- the repository exceptionDatabaseException- the database exceptionPathNotFoundException- the path not found exceptionUnknownException- the unknown exceptionWebserviceException- the webservice exception
-
getRoles
List<String> getRoles(boolean showAll) throws AccessDeniedException, RepositoryException, DatabaseException, AuthException, UnknownException, WebserviceException Retrieves a list of repository roles.- Parameters:
showAll- If should only return active roles or all them- Returns:
- List
A collection of repository roles. - Throws:
AccessDeniedException- the access denied exceptionRepositoryException- the repository exceptionDatabaseException- the database exceptionAuthException- the principal adapter exceptionUnknownException- the unknown exceptionWebserviceException- the webservice exception
-
getRolesByUser
List<String> getRolesByUser(String userId) throws AccessDeniedException, RepositoryException, DatabaseException, AuthException, UnknownException, WebserviceException Retrieves a list of roles by user.- Parameters:
userId- A user id.- Returns:
- List
A repository roles. - Throws:
AccessDeniedException- the access denied exceptionRepositoryException- the repository exceptionDatabaseException- the database exceptionAuthException- the principal adapter exceptionUnknownException- the unknown exceptionWebserviceException- the webservice exception
-
getUsers
List<CommonUser> getUsers(boolean showAll) throws AccessDeniedException, RepositoryException, DatabaseException, AuthException, UnknownException, WebserviceException Retrieve information of a given user- Parameters:
showAll- If should only return active users or all them- Returns:
- List
A collection of repository users. - Throws:
AccessDeniedException- the access denied exceptionRepositoryException- the repository exceptionDatabaseException- the database exceptionAuthException- the principal adapter exceptionUnknownException- the unknown exceptionWebserviceException- the webservice exception
-
getUser
CommonUser getUser(String userId) throws AccessDeniedException, RepositoryException, DatabaseException, AuthException, UnknownException, WebserviceException Retrieve information of a given user- Parameters:
userId- A user id.- Returns:
- CommonUser The data user
- Throws:
AccessDeniedException- the access denied exceptionRepositoryException- the repository exceptionDatabaseException- the database exceptionAuthException- the principal adapter exceptionUnknownException- the unknown exceptionWebserviceException- the webservice exception
-
getUsersByRole
List<CommonUser> getUsersByRole(String roleId) throws AccessDeniedException, RepositoryException, DatabaseException, AuthException, UnknownException, WebserviceException Retrieves a list of users by role.- Parameters:
roleId- A role id.- Returns:
- List
A repository users. - Throws:
AccessDeniedException- the access denied exceptionRepositoryException- the repository exceptionDatabaseException- the database exceptionAuthException- the principal adapter exceptionUnknownException- the unknown exceptionWebserviceException- the webservice exception
-
revokeRole
void revokeRole(String uuid, String roleId, int permissions, boolean recursive) throws AccessDeniedException, RepositoryException, DatabaseException, PathNotFoundException, UnknownException, WebserviceException Revoke role permissions from a node.- Parameters:
uuid- Node uuid.roleId- Role name which permissions are changed.permissions- A mask with the permissions to be removed.recursive- If the nodePath indicates a folder, the permissions can be applied recursively.- Throws:
AccessDeniedException- the access denied exceptionRepositoryException- the repository exceptionDatabaseException- the database exceptionPathNotFoundException- the path not found exceptionUnknownException- the unknown exceptionWebserviceException- the webservice exception
-
revokeUser
void revokeUser(String uuid, String userId, int permissions, boolean recursive) throws AccessDeniedException, RepositoryException, DatabaseException, PathNotFoundException, UnknownException, WebserviceException Revoke user permissions from a node.- Parameters:
uuid- Node uuid.userId- User name which permissions are changed.permissions- A mask with the permissions to be removed.recursive- If the nodePath indicates a folder, the permissions can be revoked recursively.- Throws:
AccessDeniedException- the access denied exceptionRepositoryException- the repository exceptionDatabaseException- the database exceptionPathNotFoundException- the path not found exceptionUnknownException- the unknown exceptionWebserviceException- the webservice exception
-
grantRole
void grantRole(String uuid, String roleId, int permissions, boolean recursive) throws AccessDeniedException, RepositoryException, DatabaseException, PathNotFoundException, UnknownException, WebserviceException Grant role permissions for a node.- Parameters:
uuid- Node uuid.roleId- Role name which permissions are changed.permissions- A mask with the permissions to be removed.recursive- If the nodePath indicates a folder, the permissions can be applied recursively.- Throws:
AccessDeniedException- the access denied exceptionRepositoryException- the repository exceptionDatabaseException- the database exceptionPathNotFoundException- the path not found exceptionUnknownException- the unknown exceptionWebserviceException- the webservice exception
-
grantUser
void grantUser(String uuid, String userId, int permissions, boolean recursive) throws AccessDeniedException, RepositoryException, DatabaseException, PathNotFoundException, UnknownException, WebserviceException Add user permissions to a node.- Parameters:
uuid- Node uuid.userId- User name which permissions are changed.permissions- A mask with the permissions to be added.recursive- If the nodePath indicated a folder, the permissions can be applied recursively.- Throws:
AccessDeniedException- the access denied exceptionRepositoryException- the repository exceptionDatabaseException- the database exceptionPathNotFoundException- the path not found exceptionUnknownException- the unknown exceptionWebserviceException- the webservice exception
-
changeSecurity
void changeSecurity(String uuid, ChangeSecurity changeSecurity) throws PathNotFoundException, AccessDeniedException, RepositoryException, DatabaseException, UnknownException, WebserviceException Change several security permissions in the same call.- Parameters:
uuid- Node uuid.changeSecurity- the change security- Throws:
PathNotFoundException- the path not found exceptionAccessDeniedException- the access denied exceptionRepositoryException- the repository exceptionDatabaseException- the database exceptionUnknownException- the unknown exceptionWebserviceException- the webservice exception
-
overwriteSecurity
void overwriteSecurity(String uuid, ChangeSecurity changeSecurity) throws PathNotFoundException, AccessDeniedException, RepositoryException, DatabaseException, UnknownException, WebserviceException Change several security permissions in the same call.- Parameters:
uuid- Node uuid.changeSecurity- the change security- Throws:
PathNotFoundException- the path not found exceptionAccessDeniedException- the access denied exceptionRepositoryException- the repository exceptionDatabaseException- the database exceptionUnknownException- the unknown exceptionWebserviceException- the webservice exception
-
isLoginLowercase
Is login lowercase- Returns:
- boolean boolean
- Throws:
UnknownException- the unknown exceptionWebserviceException- the webservice exception
-
createUser
void createUser(String userId, String password, String email, String name, boolean active) throws AuthException, UnknownException, WebserviceException Method to create a new user- Parameters:
userId- A user id.password- the passwordemail- the emailname- the nameactive- the active- Throws:
AuthException- the principal adapter exceptionUnknownException- the unknown exceptionWebserviceException- the webservice exception
-
deleteUser
Method to delete a user- Parameters:
userId- A user id.- Throws:
AuthException- the principal adapter exceptionUnknownException- the unknown exceptionWebserviceException- the webservice exception
-
updateUser
void updateUser(String userId, String password, String email, String name, boolean active) throws AuthException, UnknownException, WebserviceException Update user information- Parameters:
userId- A user id.password- the passwordemail- the emailname- the nameactive- the active- Throws:
AuthException- the principal adapter exceptionUnknownException- the unknown exceptionWebserviceException- the webservice exception
-
createRole
void createRole(String roleId, boolean active) throws AuthException, UnknownException, WebserviceException Method to create a new role- Parameters:
roleId- A role id.active- the active- Throws:
AuthException- the principal adapter exceptionUnknownException- the unknown exceptionWebserviceException- the webservice exception
-
deleteRole
Method to create a delete a role- Parameters:
roleId- A role id.- Throws:
AuthException- the principal adapter exceptionUnknownException- the unknown exceptionWebserviceException- the webservice exception
-
updateRole
void updateRole(String roleId, boolean active) throws AuthException, UnknownException, WebserviceException Update role information- Parameters:
roleId- A role idactive- the active- Throws:
AuthException- the principal adapter exceptionUnknownException- the unknown exceptionWebserviceException- the webservice exception
-
assignRole
void assignRole(String userId, String roleId) throws AuthException, UnknownException, WebserviceException Method to assign a role- Parameters:
userId- A user id.roleId- A role id.- Throws:
AuthException- the principal adapter exceptionUnknownException- the unknown exceptionWebserviceException- the webservice exception
-
removeRole
void removeRole(String userId, String roleId) throws AuthException, UnknownException, WebserviceException Method to remove a role- Parameters:
userId- A user id.roleId- A role id.- Throws:
AuthException- the principal adapter exceptionUnknownException- the unknown exceptionWebserviceException- the webservice exception
-
getProfiles
List<Profile> getProfiles(boolean filterByActive) throws AuthException, WebserviceException, UnknownException Get all profiles- Parameters:
filterByActive- the filter by active- Returns:
- List
A list with all the registered profiles. - Throws:
AuthException- the principal adapter exceptionWebserviceException- the webservice exceptionUnknownException- the unknown exception
-
getUserProfile
Get user profile- Parameters:
userId- A user id.- Returns:
- Profile Return the profile assigned to a user.
- Throws:
AuthException- the principal adapter exceptionWebserviceException- the webservice exceptionUnknownException- the unknown exception
-
setUserProfile
void setUserProfile(String userId, long profileId) throws AuthException, WebserviceException, UnknownException Set the user profile- Parameters:
userId- The user id.profileId- The profile to be assigned.- Throws:
AuthException- the principal adapter exceptionWebserviceException- the webservice exceptionUnknownException- the unknown exception
-
getUserToken
Get user token- Parameters:
userId- A user id.- Returns:
- String Return the token to a user.
- Throws:
AuthException- the principal adapter exceptionWebserviceException- the webservice exceptionUnknownException- the unknown exception
-
setUserPermissions
void setUserPermissions(String uuid, String userId, int permissions, boolean recursive) throws PathNotFoundException, AccessDeniedException, RepositoryException, DatabaseException, WebserviceException, UnknownException Set user permissions to a node- Parameters:
uuid- Node uuid.userId- User name which permissions are set.permissions- User name which permissions are set.recursive- recursive – If the nodePath indicated a folder, the permissions can be applied recursively.- Throws:
PathNotFoundException- the path not found exceptionAccessDeniedException- the access denied exceptionRepositoryException- the repository exceptionDatabaseException- the database exceptionWebserviceException- the webservice exceptionUnknownException- the unknown exception
-
setRolePermissions
void setRolePermissions(String uuid, String roleId, int permissions, boolean recursive) throws PathNotFoundException, AccessDeniedException, RepositoryException, DatabaseException, WebserviceException, UnknownException Set role permissions for a node.- Parameters:
uuid- Node uuid.roleId- Role name which permissions are set.permissions- A mask with the permissions to be set.recursive- If the nodePath indicates a folder, the permissions can be applied recursively.- Throws:
PathNotFoundException- the path not found exceptionAccessDeniedException- the access denied exceptionRepositoryException- the repository exceptionDatabaseException- the database exceptionWebserviceException- the webservice exceptionUnknownException- the unknown exception
-
getUserTenants
List<Tenant> getUserTenants() throws AccessDeniedException, RepositoryException, DatabaseException, PathNotFoundException, UnknownException, WebserviceExceptionGet a list of available tenants for a user.- Returns:
- List
the list of tenants - Throws:
AccessDeniedException- the access denied exceptionRepositoryException- the repository exceptionDatabaseException- the database exceptionPathNotFoundException- the path not found exceptionUnknownException- the unknown exceptionWebserviceException- the webservice exception
-
setUserTenant
void setUserTenant(long tenantId) throws AccessDeniedException, RepositoryException, DatabaseException, PathNotFoundException, UnknownException, WebserviceException Update user tenant.- Parameters:
tenantId- tenantId tenant id- Throws:
AccessDeniedException- the access denied exceptionRepositoryException- the repository exceptionDatabaseException- the database exceptionPathNotFoundException- the path not found exceptionUnknownException- the unknown exceptionWebserviceException- the webservice exception
-
isTwoFactorAuthentication
Is two factor authentication- Returns:
- true active two factor autentication
- Throws:
UnknownException- the unknown exceptionWebserviceException- the webservice exception
-
getTwoFactorQR
InputStream getTwoFactorQR(String secret) throws AuthException, UnknownException, WebserviceException Get 2FA- Parameters:
secret- the secret- Returns:
- stream with 2FA qr image
- Throws:
AuthException- the principal adapter exceptionUnknownException- the unknown exceptionWebserviceException- the webservice exception
-
generate2FASecret
Generate 2FA secret- Returns:
- String with 2FA secret
- Throws:
AuthException- the principal adapter exceptionUnknownException- the unknown exceptionWebserviceException- the webservice exception
-
validate2FAAndSaveSecret
String validate2FAAndSaveSecret(String secret, int code) throws AuthException, UnknownException, WebserviceException Validate 2FA and save secret- Parameters:
secret- the secretcode- the code- Returns:
- String string
- Throws:
AuthException- the principal adapter exceptionUnknownException- the unknown exceptionWebserviceException- the webservice exception
-
disable2FA
Disable 2FA- Returns:
- String string
- Throws:
AuthException- the principal adapter exceptionUnknownException- the unknown exceptionWebserviceException- the webservice exception
-
verify2FACode
Verify 2FA code- Parameters:
code- the code- Returns:
- int string
- Throws:
AuthException- the principal adapter exceptionUnknownException- the unknown exceptionWebserviceException- the webservice exception
-
createPersonalAccessToken
String createPersonalAccessToken(String name, Calendar expiration) throws DatabaseException, UnknownException, WebserviceException Create personal access token- Parameters:
name- the nameexpiration- the expiration- Returns:
- String string
- Throws:
DatabaseException- the database exceptionUnknownException- the unknown exceptionWebserviceException- the webservice exception
-