public interface UserManager
Modifier and Type | Method and Description |
---|---|
boolean |
authenticate(String username,
String password)
Given a username and password, this method checks whether or not the provided user can be authenticated
|
Iterable<String> |
findGroupNamesByPrefix(String prefix,
int startIndex,
int maxResults)
Returns a list of group names.
|
UserProfile |
getRemoteUser()
Returns the profile of the currently logged in user or null if no user can be found.
|
UserProfile |
getRemoteUser(javax.servlet.http.HttpServletRequest request)
Returns the
UserProfile of the currently logged in user or null if no user can be found. |
UserKey |
getRemoteUserKey()
Returns the key of the currently logged in user or null if no user can be found.
|
UserKey |
getRemoteUserKey(javax.servlet.http.HttpServletRequest request)
Returns the
UserKey of the currently logged in user or null if no user can be found. |
String |
getRemoteUsername()
Deprecated.
since 2.10, use
getRemoteUser() or getRemoteUserKey() instead |
String |
getRemoteUsername(javax.servlet.http.HttpServletRequest request)
Deprecated.
since 2.10, use
getRemoteUser(javax.servlet.http.HttpServletRequest) instead. |
UserProfile |
getUserProfile(String username)
Returns a
UserProfile object for the specified user or null if no user can be found |
UserProfile |
getUserProfile(UserKey userKey)
Returns a
UserProfile object for the specified user or null if no user can be found |
boolean |
isAdmin(String username)
Deprecated.
since 2.10, use
isAdmin(UserKey) instead |
boolean |
isAdmin(UserKey userKey)
Returns
true or false depending on whether a user has been granted the administrator permission. |
boolean |
isSystemAdmin(String username)
Deprecated.
since 2.10, use
isSystemAdmin(UserKey) instead |
boolean |
isSystemAdmin(UserKey userKey)
Returns
true or false depending on whether a user has been granted the system administrator permission. |
boolean |
isUserInGroup(String username,
String group)
Deprecated.
since 2.10, use
isUserInGroup(UserKey, String) instead |
boolean |
isUserInGroup(UserKey userKey,
String group)
Returns whether the given user is in the given group
|
Principal |
resolve(String username)
Returns the user that made this request or
null if this application does not have such a user. |
@Deprecated @Nullable String getRemoteUsername()
getRemoteUser()
or getRemoteUserKey()
insteadgetRemoteUsername(HttpServletRequest)
.@Nullable UserProfile getRemoteUser()
Getting the full UserProfile
may have performance implications in some applications. Consider using getRemoteUserKey()
if you don't need the full object.
UserProfile
of the logged in user or nullgetRemoteUserKey()
@Nullable UserKey getRemoteUserKey()
UserKey
of the logged in user or nullgetRemoteUser()
@Deprecated @Nullable String getRemoteUsername(javax.servlet.http.HttpServletRequest request)
getRemoteUser(javax.servlet.http.HttpServletRequest)
instead.
* Note: Implementing applications might not actually be using the HttpServletRequest
, but actually using an internal ThreadLocal
authentication context.
request
- The request to retrieve the username from@Nullable UserProfile getRemoteUser(javax.servlet.http.HttpServletRequest request)
UserProfile
of the currently logged in user or null if no user can be found.
Getting the full UserProfile
may have performance implications in some applications. Consider using getRemoteUserKey()
if you don't need the full object.
* Note: Implementing applications might not actually be using the HttpServletRequest
, but actually using an internal ThreadLocal
authentication context.
request
- The request to retrieve the username fromgetRemoteUser()
,
getRemoteUserKey(javax.servlet.http.HttpServletRequest)
@Nullable UserKey getRemoteUserKey(javax.servlet.http.HttpServletRequest request)
UserKey
of the currently logged in user or null if no user can be found.
Note: Implementing applications might not actually be using the HttpServletRequest
, but actually using an internal ThreadLocal
authentication context.
request
- The request to retrieve the username fromgetRemoteUserKey()
,
getRemoteUser(javax.servlet.http.HttpServletRequest)
@Nullable UserProfile getUserProfile(@Nullable String username)
UserProfile object
for the specified user or null if no user can be foundusername
- The username of the user whose profile is requested@Nullable UserProfile getUserProfile(@Nullable UserKey userKey)
UserProfile object
for the specified user or null if no user can be founduserKey
- The userKey of the user whose profile is requested@Deprecated boolean isUserInGroup(@Nullable String username, @Nullable String group)
isUserInGroup(UserKey, String)
insteadusername
- The username to checkgroup
- The group to checktrue
if the user is in the specified groupboolean isUserInGroup(@Nullable UserKey userKey, @Nullable String group)
userKey
- The usergroup
- The grouptrue
if the user is in the specified group@Deprecated boolean isSystemAdmin(@Nullable String username)
isSystemAdmin(UserKey)
insteadtrue
or false
depending on whether a user has been granted the system administrator permission. A system administrator has full administrative permissions in the
application, including permission to perform operations that may affect the underlying operating system, such as specifying filesystem paths, installing plugins, configuring mail servers and
logging, performing backups and restores, etc. Only check for system administrator when performing this type of operation. Operations that do not affect the underlying system should use isAdmin(String)
instead.username
- The username of the user to checktrue
or false
depending on whether a user has been granted the system admin permission.boolean isSystemAdmin(@Nullable UserKey userKey)
true
or false
depending on whether a user has been granted the system administrator permission. A system administrator has full administrative permissions in the
application, including permission to perform operations that may affect the underlying operating system, such as specifying filesystem paths, installing plugins, configuring mail servers and
logging, performing backups and restores, etc. Only check for system administrator when performing this type of operation. Operations that do not affect the underlying system should use isAdmin(String)
instead.userKey
- The key of the user to checktrue
or false
depending on whether a user has been granted the system admin permission.@Deprecated boolean isAdmin(@Nullable String username)
isAdmin(UserKey)
insteadtrue
or false
depending on whether a user has been granted the administrator permission. An administrator may have restricted administrative permissions that only apply
to application-level configuration that cannot affect the underlying operating system. Only check for administrator permission when performing this type of operation. Operations that can affect
security, the filesystem, or allow arbitrary code execution must check isSystemAdmin(String)
instead.
Note that system administrator permission implies administrator permission. That is, any username for which userManager.isSystemAdmin(username)
returns true
will also return
true
for userManager.isAdmin(username)
.
username
- The username of the user to checktrue
or false
depending on whether the user has been granted the admin permissionboolean isAdmin(@Nullable UserKey userKey)
true
or false
depending on whether a user has been granted the administrator permission. An administrator may have restricted administrative permissions that only apply
to application-level configuration that cannot affect the underlying operating system. Only check for administrator permission when performing this type of operation. Operations that can affect
security, the filesystem, or allow arbitrary code execution must check isSystemAdmin(String)
instead.
Note that system administrator permission implies administrator permission. That is, any username for which userManager.isSystemAdmin(username)
returns true
will also return
true
for userManager.isAdmin(username)
.
userKey
- The user of the user to checktrue
or false
depending on whether the user has been granted the admin permissionboolean authenticate(String username, String password)
username
- Username of the userpassword
- Password of the usertrue
if the user can be authenticated, false
otherwise@Nullable Principal resolve(String username) throws UserResolutionException
null
if this application does not have such a user.username
- Username of the user a consumer is making a request on behalf ofPrincipal
corresponding to the username, null
if the user does not existUserResolutionException
- thrown if there is a problem resolving the user, such as a failure when accessing an external user storeIterable<String> findGroupNamesByPrefix(String prefix, int startIndex, int maxResults)
prefix
- only return groups with names matching this prefixstartIndex
- don't return the first startIndex resultsmaxResults
- return at most this many resultsCopyright © 2017 Atlassian. All rights reserved.