public class PublicUserManager extends GenericUserManager
Essentially this user manager makes all functionality public accessible by always returning a user which has a defined set of roles (therefore one can of course disable some functions entirely).
This roles granted can be controlled by two config entries. One is security.publicRoles which also affects all other user managers. The other is defaultRoles which has to be defined within the scope.
Note that also trustedRoles can be defined to control roles which are only added to a trusted user (i.e. from the local network).
| Modifier and Type | Class and Description |
|---|---|
static class |
PublicUserManager.Factory
Used to create public user managers.
|
config, defaultRoles, defaultUser, hashFunction, keepLoginEnabled, loginCookieTTL, publicRoles, scope, ssoEnabled, ssoGraceInterval, ssoSecret, trustedRoles| Modifier | Constructor and Description |
|---|---|
protected |
PublicUserManager(ScopeInfo scope,
sirius.kernel.settings.Extension config) |
| Modifier and Type | Method and Description |
|---|---|
void |
attachToSession(UserInfo user,
WebContext ctx)
Attaches the given user to the current session.
|
UserInfo |
bindToRequest(WebContext ctx)
Tries to find the current user in the current session or by checking the request for valid credentials
|
protected String |
computeLang(WebContext ctx,
String userId)
Compues the langange code of the given user and request.
|
protected Set<String> |
computeRoles(WebContext ctx,
String userId)
Tries to compute the roles for the given user and request.
|
protected String |
computeTenantname(WebContext ctx,
String tenantId)
Compues the name of the given tenant and request.
|
protected String |
computeUsername(WebContext ctx,
String userId)
Compues the name of the given user and request.
|
void |
detachFromSession(UserInfo user,
WebContext ctx)
Removes all stored user information from the current session.
|
UserInfo |
findUserByCredentials(WebContext ctx,
String user,
String password)
Tries to find a user with the given credentials.
|
UserInfo |
findUserByName(WebContext ctx,
String user)
Tries to find a user with the given username.
|
protected Object |
getUserObject(UserInfo u)
Resolves the given user info back into the original (underlying) user object.
|
boolean |
isLoginSupported()
Determines if a login via username and password is possible.
|
buildDefaultUser, computeSSOHashInput, computeSSOToken, determineRolesOfDefaultUser, extractChallengeAndResponse, findUserForRequest, findUserInSession, getScopeSettings, getSSOHashFunction, getUserSettings, isKeepLoginSupported, isUserStillValid, log, recordUserLogin, transformRoles, updateLoginCookieprotected PublicUserManager(ScopeInfo scope, sirius.kernel.settings.Extension config)
@Nonnull public UserInfo bindToRequest(@Nonnull WebContext ctx)
UserManagerbindToRequest in interface UserManagerbindToRequest in class GenericUserManagerctx - the request to attach toUserInfo.NOBODY can be used.public UserInfo findUserByName(@Nullable WebContext ctx, String user)
UserManagerctx - the current HTTP request if one is presentuser - the login name of the user to findpublic UserInfo findUserByCredentials(@Nullable WebContext ctx, String user, String password)
UserManagerctx - the current HTTP request if one is presentuser - the login name of the user to findpassword - the password of the user to findprotected Object getUserObject(UserInfo u)
GenericUserManagergetUserObject in class GenericUserManageru - the user info which was passed to the outside world.@Nullable protected Set<String> computeRoles(@Nullable WebContext ctx, String userId)
GenericUserManagerIf a server session is available, we try to load the roles from there.
computeRoles in class GenericUserManagerctx - the current requestuserId - the id of the user to fetch roles for@Nonnull protected String computeUsername(@Nullable WebContext ctx, String userId)
GenericUserManagercomputeUsername in class GenericUserManagerctx - the current requestuserId - the id of the user to fetch the name for@Nonnull protected String computeTenantname(@Nullable WebContext ctx, String tenantId)
GenericUserManagercomputeTenantname in class GenericUserManagerctx - the current requesttenantId - the id of the tenant to fetch the name for@Nonnull protected String computeLang(WebContext ctx, String userId)
GenericUserManagercomputeLang in class GenericUserManagerctx - the current requestuserId - the id of the user to fetch the language forpublic void attachToSession(@Nonnull UserInfo user, @Nonnull WebContext ctx)
GenericUserManagerThis will make the login persistent across requests (if session management is enabled).
attachToSession in interface UserManagerattachToSession in class GenericUserManageruser - the user to attach to the sessionctx - the current request to attach the user topublic void detachFromSession(@Nonnull UserInfo user, @Nonnull WebContext ctx)
GenericUserManagerdetachFromSession in interface UserManagerdetachFromSession in class GenericUserManageruser - the current user - passed in, in case a cache etc. has to be clearedctx - the request to remove all data frompublic boolean isLoginSupported()
UserManagerisLoginSupported in interface UserManagerisLoginSupported in class GenericUserManagerCopyright © 2018. All rights reserved.