Package com.openkm.sdk4j.definition
Interface BaseAuth
-
- All Known Implementing Classes:
AuthImpl
public interface BaseAuthBaseAuth- Author:
- jllort
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidassignRole(String userId, String roleId)Method to assign a rolevoidchangeSecurity(String uuid, ChangeSecurity changeSecurity)Change several security permissions in the same call.StringcreatePersonalAccessToken(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 userStringdisable2FA()Disable 2FAStringgenerate2FASecret()Generate 2FA secretMap<String,Integer>getGrantedRoles(String uuid)Get roles permissions from am item (document or folder).Map<String,Integer>getGrantedUsers(String uuid)Get user permissions from am item (document or folder).GrantedUsersAndRolesItemgetGrantedUsersAndRoles(String uuid)Get granted users and rolesList<Profile>getProfiles(boolean filterByActive)Get all profilesList<String>getRoles(boolean showAll)Retrieves a list of repository roles.List<String>getRolesByUser(String userId)Retrieves a list of roles by user.StringgetSessionId()Get sessionInputStreamgetTwoFactorQR(String secret)Get 2FACommonUsergetUser(String userId)Retrieve information of a given userProfilegetUserProfile(String userId)Get user profileList<CommonUser>getUsers(boolean showAll)Retrieve information of a given userList<CommonUser>getUsersByRole(String roleId)Retrieves a list of users by role.List<Tenant>getUserTenants()Get a list of available tenants for a user.StringgetUserToken(String userId)Get user tokenvoidgrantRole(String uuid, String roleId, int permissions, boolean recursive)Grant role permissions for a node.voidgrantUser(String uuid, String userId, int permissions, boolean recursive)Add user permissions to a node.booleanisLoginLowercase()Is login lowercasebooleanisTwoFactorAuthentication()Is 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 informationStringvalidate2FAAndSaveSecret(String secret, int code)Validate 2FA and save secretStringverify2FACode(int code)Verify 2FA code
-
-
-
Method Detail
-
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
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
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
boolean isLoginLowercase() throws UnknownException, WebserviceExceptionIs 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
void deleteUser(String userId) throws AuthException, UnknownException, WebserviceException
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
void deleteRole(String roleId) throws AuthException, UnknownException, WebserviceException
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
Profile getUserProfile(String userId) throws AuthException, WebserviceException, UnknownException
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
String getUserToken(String userId) throws AuthException, WebserviceException, UnknownException
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, WebserviceException
Get 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, WebserviceExceptionUpdate 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
boolean isTwoFactorAuthentication() throws UnknownException, WebserviceExceptionIs 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
String generate2FASecret() throws AuthException, UnknownException, WebserviceException
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
String disable2FA() throws AuthException, UnknownException, WebserviceException
Disable 2FA- Returns:
- String string
- Throws:
AuthException- the principal adapter exceptionUnknownException- the unknown exceptionWebserviceException- the webservice exception
-
verify2FACode
String verify2FACode(int code) throws AuthException, UnknownException, WebserviceException
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
-
-