Package org.artifactory.security
Interface Security
-
public interface SecurityThese are the usage of security data and logged in user methods.- Author:
- Fred Simon
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description booleancanAdmin(RepoPath path)Deprecated.Use#canManage()insteadbooleancanAnnotate(RepoPath repoPath)booleancanDelete(RepoPath path)booleancanDeploy(RepoPath path)booleancanManage(RepoPath path)booleancanRead(RepoPath path)UsercurrentUser()java.lang.StringcurrentUsername()Deprecated.UsegetCurrentUsername()insteadUserfindUser(java.lang.String username)Accessible only if current user is an admin.java.lang.String[]getCurrentUserGroupNames()The group names for the current logged-in user.java.lang.String[]getCurrentUserGroupNames(RealmAwareGroupsSettings settings)Retrieves the groups of the current user according to the given realm settings Available realms areLdapGroupsSettingsandCrowdGroupsSettingsjava.lang.StringgetCurrentUsername()java.lang.StringgetEncryptedPassword()java.lang.StringgetEscapedEncryptedPassword()Deprecated.No need to escape a base58 passwordbooleanisAdmin()booleanisAnonAccessEnabled()booleanisAnonymous()booleanisAuthenticated()booleanisUpdatableProfile()voidpopulateUserProperties(User user)Attaches all the user properties to the given uservoidupdateUser(User user)Update the user with the same username as the user.getUsername() passed.
NOTE: Only updatable fields will be updated.
The user object cannot be null, and user.getUsername() should represent an existing non-anonymous or system user.
-
-
-
Method Detail
-
isUpdatableProfile
boolean isUpdatableProfile()
- Returns:
- True if the current user can update her profile.
-
isAnonAccessEnabled
boolean isAnonAccessEnabled()
- Returns:
- True if anonymous access is allowed.
-
canRead
boolean canRead(RepoPath path)
- Returns:
- True if the current user can read the specified path.
-
canAnnotate
boolean canAnnotate(RepoPath repoPath)
- Returns:
- True if the current user can annotate the specified path.
-
canDelete
boolean canDelete(RepoPath path)
- Returns:
- True if the current user can delete the specified path.
-
canDeploy
boolean canDeploy(RepoPath path)
- Returns:
- True if the current user can deploy to the specified path.
-
canAdmin
@Deprecated boolean canAdmin(RepoPath path)
Deprecated.Use#canManage()instead- Returns:
- True if the current user has admin permissions on a target info that includes this path..
-
canManage
boolean canManage(RepoPath path)
- Returns:
- True if the current user has manage permissions on a target info that includes this path..
-
getCurrentUsername
java.lang.String getCurrentUsername()
- Returns:
- The current logged-in user name.
- Since:
- 2.3.3
-
currentUsername
@Deprecated java.lang.String currentUsername()
Deprecated.UsegetCurrentUsername()insteadThe current logged in-user name.- Returns:
- The current logged in-user name
-
getCurrentUserGroupNames
java.lang.String[] getCurrentUserGroupNames()
The group names for the current logged-in user.- Returns:
- A list of group names associated with the current user.
- Since:
- 2.3.3
-
getCurrentUserGroupNames
java.lang.String[] getCurrentUserGroupNames(RealmAwareGroupsSettings settings)
Retrieves the groups of the current user according to the given realm settings Available realms areLdapGroupsSettingsandCrowdGroupsSettings- Parameters:
settings- Realm specific settings- Returns:
- A list of group names associated with the current user with the relevant realm.
- Since:
- 4.1.0
-
isAdmin
boolean isAdmin()
- Returns:
- True if the current is a system administrator.
-
isAnonymous
boolean isAnonymous()
- Returns:
- True if the current user is a anonymous.
-
isAuthenticated
boolean isAuthenticated()
- Returns:
- True if a user (anonymous and system are also users) is logged in.
-
getEncryptedPassword
java.lang.String getEncryptedPassword()
- Returns:
- The encrypted password of the current user
-
getEscapedEncryptedPassword
@Deprecated java.lang.String getEscapedEncryptedPassword()
Deprecated.No need to escape a base58 passwordUsed in default settings.xml filtered resource file.- Returns:
- the encrypted password of the current user, no need for escaping anymore
-
currentUser
User currentUser()
- Returns:
- The current logged in user, the anonymous user or null if no authentication details present.
-
findUser
User findUser(java.lang.String username)
Accessible only if current user is an admin.- Returns:
- The user with the given username if exists or null.
- Throws:
java.lang.SecurityException- if the current user is not an admin user
-
populateUserProperties
void populateUserProperties(User user)
Attaches all the user properties to the given user- Parameters:
user- The user to attach properties to
-
updateUser
void updateUser(User user)
Update the user with the same username as the user.getUsername() passed.
NOTE: Only updatable fields will be updated.
The user object cannot be null, and user.getUsername() should represent an existing non-anonymous or system user. Here are the fields that will be updated and the conditions:- user.getEmail() will be updated if not null
- user.isAdmin() will be updated
- user.isEnabled() will be updated
- user.isUpdatableProfile() will be updated
- user.getPrivateKey() will be updated if not null
- user.getPublicKey() will be updated if not null
- user.isTransientUser() will be updated
- user.getGroups() will be updated if not null and all group name exists
- user.getBintrayAuth() will be updated if not null
- Parameters:
user- the user with all the fields to update- Throws:
java.lang.SecurityException- if the current user is not an admin user, if the user passed is the anonymous user, if one of the group passed does not existsorg.artifactory.storage.StorageException- if the user could not updated
-
-