Class ShiroSecurityContext

java.lang.Object
org.apache.shiro.web.jaxrs.ShiroSecurityContext
All Implemented Interfaces:
javax.ws.rs.core.SecurityContext

public class ShiroSecurityContext extends Object implements javax.ws.rs.core.SecurityContext
A Shiro based SecurityContext that exposes the current Shiro Subject as a Principal. The isUserInRole(String) method returns the result of Subject.hasRole(String).
Since:
1.4
  • Constructor Details

    • ShiroSecurityContext

      public ShiroSecurityContext(javax.ws.rs.container.ContainerRequestContext containerRequestContext)
  • Method Details

    • getUserPrincipal

      public Principal getUserPrincipal()
      Specified by:
      getUserPrincipal in interface javax.ws.rs.core.SecurityContext
    • isUserInRole

      public boolean isUserInRole(String role)
      Specified by:
      isUserInRole in interface javax.ws.rs.core.SecurityContext
    • isSecure

      public boolean isSecure()
      Specified by:
      isSecure in interface javax.ws.rs.core.SecurityContext
    • getAuthenticationScheme

      public String getAuthenticationScheme()
      Specified by:
      getAuthenticationScheme in interface javax.ws.rs.core.SecurityContext