## com.sun.jersey.spi.container
Interface SubjectSecurityContext

All Superinterfaces:
  SecurityContext

    public interface SubjectSecurityContext

extends SecurityContext

Security context that allows establishing a subject before a resource method or a sub-resource locator is called. Container or filters should set an implementation of this interface to the request context using `ContainerRequest.setSecurityContext(javax.ws.rs.core.SecurityContext)`. When Jersey detects this kind of context is in the request scope, it will use `doAsSubject(java.security.PrivilegedAction)` method to dispatch the request to a resource method (or to call a sub-resource locator).

Author:
  Martin Matula <martin.matula@oracle.com>

Field Summary

Fields inherited from interface javax.ws.rs.core.SecurityContext
`BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH`

Method Summary
`java.lang.Object` | `doAsSubject(java.security.PrivilegedAction action)` Jersey wraps calls to resource methods and sub-resource locators in `PrivilegedAction` instance and passes it to this method when dispatching a request.

Methods inherited from interface javax.ws.rs.core.SecurityContext
`getAuthenticationScheme, getUserPrincipal, isSecure, isUserInRole`

Method Detail

### doAsSubject

    java.lang.Object doAsSubject(java.security.PrivilegedAction action)

  Jersey wraps calls to resource methods and sub-resource locators in `PrivilegedAction` instance and passes it to this method when dispatching a request. Implementations should do the needful to establish a `javax.security.auth.Subject` and invoke the `PrivilegedAction` passed as the parameter using `javax.security.auth.Subject#doAs(javax.security.auth.Subject, java.security.PrivilegedAction)`.

  Parameters:
    `action` - - `PrivilegedAction` to be executed by this method after establishing a subject.
  Returns:
    result of the action

Copyright © 2017 Oracle Corporation. All Rights Reserved.