Interface UserContext
public interface UserContext
A web user is extended user coupled to the context and is used to perform verifications
and actions on behalf of the user. Actions can be:
refresh()- Require a re-authentication to confirm the user is presentimpersonate()- Require a re-authentication to switch user identitiesrestore()- De-escalate a previous impersonate calllogout()- Logout the user from this application and redirect to a uriclear()- Same as logout, without requirind a redirect
-
Method Summary
Modifier and TypeMethodDescriptiondefault booleanvoidclear()Clear can be called from any route handler which needs to terminate a login session.get()Get the authenticated user (if any).Impersonates a second identity.impersonate(String redirectUri) Impersonates a second identity.When performing a web identity operation, hint if possible to the identity provider to use the given login.logout()Logout can be called from any route handler which needs to terminate a login session.Logout can be called from any route handler which needs to terminate a login session.refresh()Forces the current user to re-authenticate.Forces the current user to re-authenticate.restore()Undo a previous call to a impersonation.Undo a previous call to an impersonation.
-
Method Details
-
get
User get()Get the authenticated user (if any). This will usually be injected by an auth handler if authentication if successful.- Returns:
- the user, or null if the current user is not authenticated.
-
authenticated
default boolean authenticated() -
loginHint
When performing a web identity operation, hint if possible to the identity provider to use the given login.- Parameters:
loginHint- the desired login name, for example:admin.- Returns:
- fluent self
-
refresh
-
refresh
Forces the current user to re-authenticate. The user will be redirected to the given uri. It is important to notice that the redirect will only allow targets using an HTTP GET request.- Parameters:
redirectUri- the uri to redirect the user to after the re-authentication.- Returns:
- future result of the operation.
-
impersonate
-
impersonate
Impersonates a second identity. The user will be redirected to the given uri. It is important to notice that the redirect will only allow targets using an HTTP GET request.- Parameters:
redirectUri- the uri to redirect the user to after the authentication.- Returns:
- future result of the operation.
-
restore
-
restore
Undo a previous call to an impersonation. The user will be redirected to the given uri. It is important to notice that the redirect will only allow targets using an HTTP GET request.- Parameters:
redirectUri- the uri to redirect the user to after the re-authentication.- Returns:
- future result of the operation.
-
logout
Logout can be called from any route handler which needs to terminate a login session. Invoking logout will remove theUserand clear theSession(if any) in the current context. Followed by a redirect to the given uri.- Parameters:
redirectUri- the uri to redirect the user to after the logout.- Returns:
- future result of the operation.
-
logout
-
clear
-