public final class BasicAuthSecurityContext
extends Object
implements SecurityContext
SecurityContext that wraps a user provided Principal,
and which is designed for the SecurityContext.BASIC_AUTH authentication scheme.| Constructor and Description |
|---|
BasicAuthSecurityContext(Principal principal,
boolean secure)
Creates a new instance, which has no support for roles.
|
BasicAuthSecurityContext(Principal principal,
boolean secure,
Predicate<String> userInRolePredicate)
Creates a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
String |
getAuthenticationScheme() |
Principal |
getUserPrincipal() |
boolean |
isSecure() |
boolean |
isUserInRole(String role) |
public BasicAuthSecurityContext(Principal principal,
boolean secure)
principal - the wrapped Principalsecure - true if the request was received over a secure channelSecurityContext.isSecure()public BasicAuthSecurityContext(Principal principal,
boolean secure,
@Nullable
Predicate<String> userInRolePredicate)
principal - the wrapped Principal.secure - true if the request was received over a secure channeluserInRolePredicate - the Predicate used to check if the user is in a roleSecurityContext.isSecure()public Principal getUserPrincipal()
getUserPrincipal in interface SecurityContextpublic boolean isUserInRole(String role)
isUserInRole in interface SecurityContextpublic boolean isSecure()
isSecure in interface SecurityContextpublic String getAuthenticationScheme()
getAuthenticationScheme in interface SecurityContext