public class AuthImpl extends ClientImpl implements BaseAuth, Serializable
| Modifier and Type | Method and Description |
|---|---|
void |
assignRole(String userId,
String roleId)
Method to assign a role
|
void |
changeSecurity(String uuid,
ChangeSecurity changeSecurity)
Change several security permissions in the same call.
|
void |
createRole(String roleId,
boolean active)
Method to create a new role
|
void |
createUser(String userId,
String password,
String email,
String name,
boolean active)
Method to create a new user
|
void |
deleteRole(String roleId)
Method to create a delete a role
|
void |
deleteUser(String userId)
Method to delete a user
|
String |
disable2FA()
Disable 2FA
|
String |
generate2FASecret()
Generate 2FA secret
|
Map<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).
|
GrantedUsersAndRolesItem |
getGrantedUsersAndRoles(String uuid)
Get granted users and roles
|
List<Profile> |
getProfiles(boolean filterByActive)
Get all profiles
|
String |
getRefreshToken() |
List<String> |
getRoles(boolean showAll)
Retrieves a list of repository roles.
|
List<String> |
getRolesByUser(String userId)
Retrieves a list of roles by user.
|
String |
getSessionId()
Get session
|
InputStream |
getTwoFactorQR(String secret)
Get 2FA
|
CommonUser |
getUser(String userId)
Retrieve information of a given user
|
Profile |
getUserProfile(String userId)
Get user profile
|
List<CommonUser> |
getUsers(boolean showAll)
Retrieve information of a given user
|
List<CommonUser> |
getUsersByRole(String roleId)
Retrieves a list of users by role.
|
List<Tenant> |
getUserTenants()
Get a list of available tenants for a user.
|
String |
getUserToken(String userId)
Get user token
|
void |
grantRole(String uuid,
String roleId,
int permissions,
boolean recursive)
Grant role permissions for a node.
|
void |
grantUser(String uuid,
String userId,
int permissions,
boolean recursive)
Add user permissions to a node.
|
boolean |
hasSecurityRecursive()
Has security recursive
|
boolean |
isAdmin()
Is admin
|
boolean |
isLoginLowercase()
Is login lowercase
|
boolean |
isPasswordExpired()
Check the password of the user expiration
|
boolean |
isTwoFactorAuthentication()
Is two factor authentication
|
protected String |
login(String user,
String password) |
protected String |
login(String user,
String password,
int expiration,
boolean restrictIp) |
protected void |
logout() |
void |
overwriteSecurity(String uuid,
ChangeSecurity changeSecurity)
Change several security permissions in the same call.
|
void |
removeRole(String userId,
String roleId)
Method to remove a role
|
void |
revokeRole(String uuid,
String roleId,
int permissions,
boolean recursive)
Revoke role permissions from a node.
|
void |
revokeUser(String uuid,
String userId,
int permissions,
boolean recursive)
Revoke user permissions from a node.
|
void |
setAuthorizationToken(String authorizationToken)
setAuthenticationToken
|
void |
setRolePermissions(String uuid,
String roleId,
int permissions,
boolean recursive)
Set role permissions for a node.
|
void |
setUserPermissions(String uuid,
String userId,
int permissions,
boolean recursive)
Set user permissions to a node
|
void |
setUserProfile(String userId,
long profileId)
Set the user profile
|
void |
setUserTenant(long tenantId)
Update user tenant.
|
void |
updateRole(String roleId,
boolean active)
Update role information
|
void |
updateUser(String userId,
String password,
String email,
String name,
boolean active)
Update user information
|
String |
validate2FAAndSaveSecret(String secret,
int code)
Validate 2FA and save secret
|
String |
verify2FACode(int code)
Verify 2FA code
|
getClient, resource, resource, resourcepublic AuthImpl(String host)
public void setAuthorizationToken(String authorizationToken)
setAuthorizationToken in interface BaseAuthauthorizationToken - the authorization tokenprotected String login(String user, String password) throws UnknownException, WebserviceException, AuthenticationException
protected String login(String user, String password, int expiration, boolean restrictIp) throws UnknownException, WebserviceException, AuthenticationException
protected void logout()
throws UnknownException,
WebserviceException
UnknownExceptionWebserviceExceptionpublic String getSessionId()
BaseAuthgetSessionId in interface BaseAuthpublic String getRefreshToken() throws UnknownException, WebserviceException
UnknownExceptionWebserviceExceptionpublic GrantedUsersAndRolesItem getGrantedUsersAndRoles(String uuid) throws AccessDeniedException, RepositoryException, DatabaseException, PathNotFoundException, UnknownException, WebserviceException
BaseAuthgetGrantedUsersAndRoles in interface BaseAuthuuid - Node uuid.AccessDeniedException - the access denied exceptionRepositoryException - the repository exceptionDatabaseException - the database exceptionPathNotFoundException - the path not found exceptionUnknownException - the unknown exceptionWebserviceException - the webservice exceptionpublic Map<String,Integer> getGrantedRoles(String uuid) throws AccessDeniedException, RepositoryException, DatabaseException, PathNotFoundException, WebserviceException, UnknownException
BaseAuthgetGrantedRoles in interface BaseAuthuuid - Node uuid.AccessDeniedException - the access denied exceptionRepositoryException - the repository exceptionDatabaseException - the database exceptionPathNotFoundException - the path not found exceptionWebserviceException - the webservice exceptionUnknownException - the unknown exceptionpublic Map<String,Integer> getGrantedUsers(String uuid) throws AccessDeniedException, RepositoryException, DatabaseException, PathNotFoundException, WebserviceException, UnknownException
BaseAuthgetGrantedUsers in interface BaseAuthuuid - Node uuid.AccessDeniedException - the access denied exceptionRepositoryException - the repository exceptionDatabaseException - the database exceptionPathNotFoundException - the path not found exceptionWebserviceException - the webservice exceptionUnknownException - the unknown exceptionpublic List<String> getRoles(boolean showAll) throws AccessDeniedException, RepositoryException, DatabaseException, PrincipalAdapterException, WebserviceException, UnknownException
BaseAuthgetRoles in interface BaseAuthshowAll - If should only return active roles or all themAccessDeniedException - the access denied exceptionRepositoryException - the repository exceptionDatabaseException - the database exceptionPrincipalAdapterException - the principal adapter exceptionWebserviceException - the webservice exceptionUnknownException - the unknown exceptionpublic List<String> getRolesByUser(String userId) throws AccessDeniedException, RepositoryException, DatabaseException, PrincipalAdapterException, WebserviceException, UnknownException
BaseAuthgetRolesByUser in interface BaseAuthuserId - A user id.AccessDeniedException - the access denied exceptionRepositoryException - the repository exceptionDatabaseException - the database exceptionPrincipalAdapterException - the principal adapter exceptionWebserviceException - the webservice exceptionUnknownException - the unknown exceptionpublic List<CommonUser> getUsers(boolean showAll) throws AccessDeniedException, RepositoryException, DatabaseException, PrincipalAdapterException, UnknownException, WebserviceException
BaseAuthgetUsers in interface BaseAuthshowAll - If should only return active users or all themAccessDeniedException - the access denied exceptionRepositoryException - the repository exceptionDatabaseException - the database exceptionPrincipalAdapterException - the principal adapter exceptionUnknownException - the unknown exceptionWebserviceException - the webservice exceptionpublic CommonUser getUser(String userId) throws AccessDeniedException, RepositoryException, DatabaseException, PrincipalAdapterException, UnknownException, WebserviceException
BaseAuthgetUser in interface BaseAuthuserId - A user id.AccessDeniedException - the access denied exceptionRepositoryException - the repository exceptionDatabaseException - the database exceptionPrincipalAdapterException - the principal adapter exceptionUnknownException - the unknown exceptionWebserviceException - the webservice exceptionpublic List<CommonUser> getUsersByRole(String roleId) throws AccessDeniedException, RepositoryException, DatabaseException, PrincipalAdapterException, UnknownException, WebserviceException
BaseAuthgetUsersByRole in interface BaseAuthroleId - A role id.AccessDeniedException - the access denied exceptionRepositoryException - the repository exceptionDatabaseException - the database exceptionPrincipalAdapterException - the principal adapter exceptionUnknownException - the unknown exceptionWebserviceException - the webservice exceptionpublic void revokeRole(String uuid, String roleId, int permissions, boolean recursive) throws AccessDeniedException, RepositoryException, DatabaseException, PathNotFoundException, UnknownException, WebserviceException
BaseAuthrevokeRole in interface BaseAuthuuid - 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.AccessDeniedException - the access denied exceptionRepositoryException - the repository exceptionDatabaseException - the database exceptionPathNotFoundException - the path not found exceptionUnknownException - the unknown exceptionWebserviceException - the webservice exceptionpublic void revokeUser(String uuid, String userId, int permissions, boolean recursive) throws AccessDeniedException, RepositoryException, DatabaseException, PathNotFoundException, UnknownException, WebserviceException
BaseAuthrevokeUser in interface BaseAuthuuid - 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.AccessDeniedException - the access denied exceptionRepositoryException - the repository exceptionDatabaseException - the database exceptionPathNotFoundException - the path not found exceptionUnknownException - the unknown exceptionWebserviceException - the webservice exceptionpublic void grantRole(String uuid, String roleId, int permissions, boolean recursive) throws AccessDeniedException, RepositoryException, DatabaseException, PathNotFoundException, UnknownException, WebserviceException
BaseAuthgrantRole in interface BaseAuthuuid - 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.AccessDeniedException - the access denied exceptionRepositoryException - the repository exceptionDatabaseException - the database exceptionPathNotFoundException - the path not found exceptionUnknownException - the unknown exceptionWebserviceException - the webservice exceptionpublic void grantUser(String uuid, String userId, int permissions, boolean recursive) throws AccessDeniedException, RepositoryException, DatabaseException, PathNotFoundException, UnknownException, WebserviceException
BaseAuthgrantUser in interface BaseAuthuuid - 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.AccessDeniedException - the access denied exceptionRepositoryException - the repository exceptionDatabaseException - the database exceptionPathNotFoundException - the path not found exceptionUnknownException - the unknown exceptionWebserviceException - the webservice exceptionpublic void createUser(String userId, String password, String email, String name, boolean active) throws PrincipalAdapterException, UnknownException, WebserviceException
BaseAuthcreateUser in interface BaseAuthuserId - A user id.password - the passwordemail - the emailname - the nameactive - the activePrincipalAdapterException - the principal adapter exceptionUnknownException - the unknown exceptionWebserviceException - the webservice exceptionpublic void deleteUser(String userId) throws PrincipalAdapterException, UnknownException, WebserviceException
BaseAuthdeleteUser in interface BaseAuthuserId - A user id.PrincipalAdapterException - the principal adapter exceptionUnknownException - the unknown exceptionWebserviceException - the webservice exceptionpublic void updateUser(String userId, String password, String email, String name, boolean active) throws PrincipalAdapterException, UnknownException, WebserviceException
BaseAuthupdateUser in interface BaseAuthuserId - A user id.password - the passwordemail - the emailname - the nameactive - the activePrincipalAdapterException - the principal adapter exceptionUnknownException - the unknown exceptionWebserviceException - the webservice exceptionpublic void createRole(String roleId, boolean active) throws PrincipalAdapterException, UnknownException, WebserviceException
BaseAuthcreateRole in interface BaseAuthroleId - A role id.active - the activePrincipalAdapterException - the principal adapter exceptionUnknownException - the unknown exceptionWebserviceException - the webservice exceptionpublic void deleteRole(String roleId) throws PrincipalAdapterException, UnknownException, WebserviceException
BaseAuthdeleteRole in interface BaseAuthroleId - A role id.PrincipalAdapterException - the principal adapter exceptionUnknownException - the unknown exceptionWebserviceException - the webservice exceptionpublic void updateRole(String roleId, boolean active) throws PrincipalAdapterException, UnknownException, WebserviceException
BaseAuthupdateRole in interface BaseAuthroleId - A role idactive - the activePrincipalAdapterException - the principal adapter exceptionUnknownException - the unknown exceptionWebserviceException - the webservice exceptionpublic void assignRole(String userId, String roleId) throws PrincipalAdapterException, UnknownException, WebserviceException
BaseAuthassignRole in interface BaseAuthuserId - A user id.roleId - A role id.PrincipalAdapterException - the principal adapter exceptionUnknownException - the unknown exceptionWebserviceException - the webservice exceptionpublic void removeRole(String userId, String roleId) throws PrincipalAdapterException, UnknownException, WebserviceException
BaseAuthremoveRole in interface BaseAuthuserId - A user id.roleId - A role id.PrincipalAdapterException - the principal adapter exceptionUnknownException - the unknown exceptionWebserviceException - the webservice exceptionpublic void changeSecurity(String uuid, ChangeSecurity changeSecurity) throws PathNotFoundException, AccessDeniedException, RepositoryException, DatabaseException, UnknownException, WebserviceException
BaseAuthchangeSecurity in interface BaseAuthuuid - Node uuid.changeSecurity - the change securityPathNotFoundException - the path not found exceptionAccessDeniedException - the access denied exceptionRepositoryException - the repository exceptionDatabaseException - the database exceptionUnknownException - the unknown exceptionWebserviceException - the webservice exceptionpublic void overwriteSecurity(String uuid, ChangeSecurity changeSecurity) throws PathNotFoundException, AccessDeniedException, RepositoryException, DatabaseException, UnknownException, WebserviceException
BaseAuthoverwriteSecurity in interface BaseAuthuuid - Node uuid.changeSecurity - the change securityPathNotFoundException - the path not found exceptionAccessDeniedException - the access denied exceptionRepositoryException - the repository exceptionDatabaseException - the database exceptionUnknownException - the unknown exceptionWebserviceException - the webservice exceptionpublic List<Profile> getProfiles(boolean filterByActive) throws PrincipalAdapterException, WebserviceException, UnknownException
BaseAuthgetProfiles in interface BaseAuthfilterByActive - the filter by activePrincipalAdapterException - the principal adapter exceptionWebserviceException - the webservice exceptionUnknownException - the unknown exceptionpublic Profile getUserProfile(String userId) throws PrincipalAdapterException, WebserviceException, UnknownException
BaseAuthgetUserProfile in interface BaseAuthuserId - A user id.PrincipalAdapterException - the principal adapter exceptionWebserviceException - the webservice exceptionUnknownException - the unknown exceptionpublic void setUserProfile(String userId, long profileId) throws PrincipalAdapterException, WebserviceException, UnknownException
BaseAuthsetUserProfile in interface BaseAuthuserId - The user id.profileId - The profile to be assigned.PrincipalAdapterException - the principal adapter exceptionWebserviceException - the webservice exceptionUnknownException - the unknown exceptionpublic String getUserToken(String userId) throws PrincipalAdapterException, WebserviceException, UnknownException
BaseAuthgetUserToken in interface BaseAuthuserId - A user id.PrincipalAdapterException - the principal adapter exceptionWebserviceException - the webservice exceptionUnknownException - the unknown exceptionpublic void setUserPermissions(String uuid, String userId, int permissions, boolean recursive) throws AccessDeniedException, RepositoryException, DatabaseException, PathNotFoundException, UnknownException, WebserviceException
BaseAuthsetUserPermissions in interface BaseAuthuuid - 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.AccessDeniedException - the access denied exceptionRepositoryException - the repository exceptionDatabaseException - the database exceptionPathNotFoundException - the path not found exceptionUnknownException - the unknown exceptionWebserviceException - the webservice exceptionpublic void setRolePermissions(String uuid, String roleId, int permissions, boolean recursive) throws AccessDeniedException, RepositoryException, DatabaseException, PathNotFoundException, UnknownException, WebserviceException
BaseAuthsetRolePermissions in interface BaseAuthuuid - 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.AccessDeniedException - the access denied exceptionRepositoryException - the repository exceptionDatabaseException - the database exceptionPathNotFoundException - the path not found exceptionUnknownException - the unknown exceptionWebserviceException - the webservice exceptionpublic List<Tenant> getUserTenants() throws AccessDeniedException, RepositoryException, DatabaseException, PathNotFoundException, UnknownException, WebserviceException
BaseAuthgetUserTenants in interface BaseAuthAccessDeniedException - the access denied exceptionRepositoryException - the repository exceptionDatabaseException - the database exceptionPathNotFoundException - the path not found exceptionUnknownException - the unknown exceptionWebserviceException - the webservice exceptionpublic void setUserTenant(long tenantId)
throws AccessDeniedException,
RepositoryException,
DatabaseException,
PathNotFoundException,
UnknownException,
WebserviceException
BaseAuthsetUserTenant in interface BaseAuthtenantId - tenantId tenant idAccessDeniedException - the access denied exceptionRepositoryException - the repository exceptionDatabaseException - the database exceptionPathNotFoundException - the path not found exceptionUnknownException - the unknown exceptionWebserviceException - the webservice exceptionpublic boolean isAdmin()
throws PrincipalAdapterException,
UnknownException,
WebserviceException
BaseAuthisAdmin in interface BaseAuthPrincipalAdapterException - the principal adapter exceptionUnknownException - the unknown exceptionWebserviceException - the webservice exceptionpublic boolean hasSecurityRecursive()
throws UnknownException,
WebserviceException
BaseAuthhasSecurityRecursive in interface BaseAuthUnknownException - the unknown exceptionWebserviceException - the webservice exceptionpublic boolean isLoginLowercase()
throws UnknownException,
WebserviceException
BaseAuthisLoginLowercase in interface BaseAuthUnknownException - the unknown exceptionWebserviceException - the webservice exceptionpublic boolean isPasswordExpired()
throws UnknownException,
WebserviceException
BaseAuthisPasswordExpired in interface BaseAuthUnknownException - the unknown exceptionWebserviceException - the webservice exceptionpublic boolean isTwoFactorAuthentication()
throws UnknownException,
WebserviceException
BaseAuthisTwoFactorAuthentication in interface BaseAuthUnknownException - the unknown exceptionWebserviceException - the webservice exceptionpublic InputStream getTwoFactorQR(String secret) throws PrincipalAdapterException, UnknownException, WebserviceException
BaseAuthgetTwoFactorQR in interface BaseAuthsecret - the secretPrincipalAdapterException - the principal adapter exceptionUnknownException - the unknown exceptionWebserviceException - the webservice exceptionpublic String generate2FASecret() throws PrincipalAdapterException, UnknownException, WebserviceException
BaseAuthgenerate2FASecret in interface BaseAuthPrincipalAdapterException - the principal adapter exceptionUnknownException - the unknown exceptionWebserviceException - the webservice exceptionpublic String validate2FAAndSaveSecret(String secret, int code) throws PrincipalAdapterException, UnknownException, WebserviceException
BaseAuthvalidate2FAAndSaveSecret in interface BaseAuthsecret - the secretcode - the codePrincipalAdapterException - the principal adapter exceptionUnknownException - the unknown exceptionWebserviceException - the webservice exceptionpublic String disable2FA() throws PrincipalAdapterException, UnknownException, WebserviceException
BaseAuthdisable2FA in interface BaseAuthPrincipalAdapterException - the principal adapter exceptionUnknownException - the unknown exceptionWebserviceException - the webservice exceptionpublic String verify2FACode(int code) throws PrincipalAdapterException, UnknownException, WebserviceException
BaseAuthverify2FACode in interface BaseAuthcode - the codePrincipalAdapterException - the principal adapter exceptionUnknownException - the unknown exceptionWebserviceException - the webservice exceptionCopyright © 2023 Open Knowledge Management System S.L.. All Rights Reserved.