public final class BasicAuthSecurityContext
extends java.lang.Object
implements javax.ws.rs.core.SecurityContext
SecurityContext
that wraps a user provided Principal
,
and which is designed for the SecurityContext.BASIC_AUTH
authentication scheme.Constructor and Description |
---|
BasicAuthSecurityContext(java.security.Principal principal,
boolean secure)
Creates a new instance, which has no support for roles.
|
BasicAuthSecurityContext(java.security.Principal principal,
boolean secure,
java.util.function.Predicate<java.lang.String> userInRolePredicate)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getAuthenticationScheme() |
java.security.Principal |
getUserPrincipal() |
boolean |
isSecure() |
boolean |
isUserInRole(java.lang.String role) |
public BasicAuthSecurityContext(java.security.Principal principal, boolean secure)
principal
- the wrapped Principal
secure
- true
if the request was received over a secure channelSecurityContext.isSecure()
public BasicAuthSecurityContext(java.security.Principal principal, boolean secure, @Nullable java.util.function.Predicate<java.lang.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 java.security.Principal getUserPrincipal()
getUserPrincipal
in interface javax.ws.rs.core.SecurityContext
public boolean isUserInRole(java.lang.String role)
isUserInRole
in interface javax.ws.rs.core.SecurityContext
public boolean isSecure()
isSecure
in interface javax.ws.rs.core.SecurityContext
public java.lang.String getAuthenticationScheme()
getAuthenticationScheme
in interface javax.ws.rs.core.SecurityContext