public abstract class AbstractUserService extends Object implements UserService
Modifier and Type | Field and Description |
---|---|
protected ApplicationService |
applicationService |
protected AuthenticatedUserProvider |
authenticatedUserProvider |
protected InternalApplicationHelper |
internalApplicationHelper |
protected TokenAuthenticationManager |
tokenAuthenticationManager |
protected UserPermissionService |
userPermissionService |
Constructor and Description |
---|
AbstractUserService(InternalApplicationHelper internalApplicationHelper,
ApplicationService applicationService,
TokenAuthenticationManager tokenAuthenticationManager,
UserPermissionService userPermissionService,
AuthenticatedUserProvider authenticatedUserProvider) |
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
|
String |
getAuthenticatedUsername(javax.servlet.http.HttpServletRequest request)
Returns the username of the currently logged in user or null if no user can be found.
|
boolean |
isAdmin(String username)
Returns true or false depending on if a user has been granted the admin or sysAdmin permission within Crowd.
|
boolean |
isSystemAdmin(String username)
Returns true or false depending on if a user has been granted the sysAdmin permission within Crowd.
|
boolean |
isUserInGroup(String username,
String group)
Returns whether the user is in the specify group
|
abstract Principal |
resolve(String username)
Returns the user that made this request or
null if this application does not have such a user. |
abstract boolean |
setAuthenticatedUser(String username)
Authenticate the current user by setting an appropriate authentication token in Spring Security's SecurityContext.
|
protected final InternalApplicationHelper internalApplicationHelper
protected final ApplicationService applicationService
protected final TokenAuthenticationManager tokenAuthenticationManager
protected final UserPermissionService userPermissionService
protected final AuthenticatedUserProvider authenticatedUserProvider
public AbstractUserService(InternalApplicationHelper internalApplicationHelper, ApplicationService applicationService, TokenAuthenticationManager tokenAuthenticationManager, UserPermissionService userPermissionService, AuthenticatedUserProvider authenticatedUserProvider)
@Nullable public String getAuthenticatedUsername(javax.servlet.http.HttpServletRequest request)
UserService
getAuthenticatedUsername
in interface UserService
request
- The request to retrieve the username frompublic boolean isUserInGroup(String username, String group)
UserService
isUserInGroup
in interface UserService
username
- The username to checkgroup
- The group to checkpublic boolean isSystemAdmin(String username)
UserService
isSystemAdmin
in interface UserService
username
- The username of the user to checkpublic boolean isAdmin(String username)
UserService
isAdmin
in interface UserService
username
- The username of the user to checkpublic boolean authenticate(String username, String password)
UserService
authenticate
in interface UserService
username
- Username of the userpassword
- Password of the userpublic abstract Principal resolve(String username)
UserService
null
if this application does not have such a user.resolve
in interface UserService
username
- Username of the user a consumer is making a request on behalf ofPrincipal
corresponding to the username, null
if the user does not existpublic abstract boolean setAuthenticatedUser(String username)
UserService
setAuthenticatedUser
in interface UserService
username
- the username of the user to authenticateCopyright © 2021 Atlassian. All rights reserved.