org.jboss.resteasy.plugins.server.servlet
Class ServletSecurityContext

java.lang.Object
  extended by org.jboss.resteasy.plugins.server.servlet.ServletSecurityContext
All Implemented Interfaces:
SecurityContext

public class ServletSecurityContext
extends java.lang.Object
implements SecurityContext

Version:
$Revision: 1 $
Author:
Bill Burke

Field Summary
 
Fields inherited from interface javax.ws.rs.core.SecurityContext
BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH
 
Constructor Summary
ServletSecurityContext(javax.servlet.http.HttpServletRequest request)
           
 
Method Summary
 java.lang.String getAuthenticationScheme()
          Returns the string value of the authentication scheme used to protect the resource.
 java.security.Principal getUserPrincipal()
          Returns a java.security.Principal object containing the name of the current authenticated user.
 boolean isSecure()
          Returns a boolean indicating whether this request was made using a secure channel, such as HTTPS.
 boolean isUserInRole(java.lang.String role)
          Returns a boolean indicating whether the authenticated user is included in the specified logical "role".
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServletSecurityContext

public ServletSecurityContext(javax.servlet.http.HttpServletRequest request)
Method Detail

getUserPrincipal

public java.security.Principal getUserPrincipal()
Description copied from interface: SecurityContext
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.

Specified by:
getUserPrincipal in interface SecurityContext
Returns:
a java.security.Principal containing the name of the user making this request; null if the user has not been authenticated

isUserInRole

public boolean isUserInRole(java.lang.String role)
Description copied from interface: SecurityContext
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.

Specified by:
isUserInRole in interface SecurityContext
Parameters:
role - a String specifying the name of the role
Returns:
a boolean indicating whether the user making the request belongs to a given role; false if the user has not been authenticated

isSecure

public boolean isSecure()
Description copied from interface: SecurityContext
Returns a boolean indicating whether this request was made using a secure channel, such as HTTPS.

Specified by:
isSecure in interface SecurityContext
Returns:
true if the request was made using a secure channel, false otherwise

getAuthenticationScheme

public java.lang.String getAuthenticationScheme()
Description copied from interface: SecurityContext
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

Specified by:
getAuthenticationScheme in interface SecurityContext
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.


Copyright © 2010. All Rights Reserved.