Top Description Fields Methods
javax.ws.rs.core

public Interface SecurityContext

Imports
java.security.Principal

An injectable interface that provides access to security related information.
Authors
Paul Sandoz, Marc Hadley
Since
1.0
See Also
Context

Field Summary

Modifier and TypeField and Description
public static final String
BASIC_AUTH

String identifier for Basic authentication.

public static final String
CLIENT_CERT_AUTH

String identifier for Client Certificate authentication.

public static final String
DIGEST_AUTH

String identifier for Digest authentication.

public static final String
FORM_AUTH

String identifier for Form authentication.

Method Summary

Modifier and TypeMethod and Description
public String

Returns:

one of the static members BASIC_AUTH, FORM_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH (suitable for == comparison) or the container-specific string indicating the authentication scheme, or null if the request was not authenticated.
getAuthenticationScheme
()

Returns the string value of the authentication scheme used to protect the resource.

public Principal

Returns:

a java.security.Principal containing the name of the user making this request; null if the user has not been authenticated
getUserPrincipal
()

Returns a java.security.Principal object containing the name of the current authenticated user.

public boolean

Returns:

true if the request was made using a secure channel, false otherwise
isSecure
()

Returns a boolean indicating whether this request was made using a secure channel, such as HTTPS.

public boolean

Returns:

a boolean indicating whether the user making the request belongs to a given role; false if the user has not been authenticated
isUserInRole
(String
a String specifying the name of the role
role
)

Returns a boolean indicating whether the authenticated user is included in the specified logical "role".

Field Detail

BASIC_AUTHback to summary
public static final String BASIC_AUTH

String identifier for Basic authentication. Value "BASIC"

CLIENT_CERT_AUTHback to summary
public static final String CLIENT_CERT_AUTH

String identifier for Client Certificate authentication. Value "CLIENT_CERT"

DIGEST_AUTHback to summary
public static final String DIGEST_AUTH

String identifier for Digest authentication. Value "DIGEST"

FORM_AUTHback to summary
public static final String FORM_AUTH

String identifier for Form authentication. Value "FORM"

Method Detail

getAuthenticationSchemeback to summary
public String getAuthenticationScheme()

Returns the string value of the authentication scheme used to protect the resource. If the resource is not authenticated, null is returned. Values are the same as the CGI variable AUTH_TYPE

Returns:String

one of the static members BASIC_AUTH, FORM_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH (suitable for == comparison) or the container-specific string indicating the authentication scheme, or null if the request was not authenticated.

Exceptions
IllegalStateException:
if called outside the scope of a request
getUserPrincipalback to summary
public Principal getUserPrincipal()

Returns a java.security.Principal object containing the name of the current authenticated user. If the user has not been authenticated, the method returns null.

Returns:Principal

a java.security.Principal containing the name of the user making this request; null if the user has not been authenticated

Exceptions
IllegalStateException:
if called outside the scope of a request
isSecureback to summary
public boolean isSecure()

Returns a boolean indicating whether this request was made using a secure channel, such as HTTPS.

Returns:boolean

true if the request was made using a secure channel, false otherwise

Exceptions
IllegalStateException:
if called outside the scope of a request
isUserInRoleback to summary
public boolean isUserInRole(String role)

Returns a boolean indicating whether the authenticated user is included in the specified logical "role". If the user has not been authenticated, the method returns false.

Parameters
role:String

a String specifying the name of the role

Returns:boolean

a boolean indicating whether the user making the request belongs to a given role; false if the user has not been authenticated

Exceptions
IllegalStateException:
if called outside the scope of a request