DefaultSecurityContext (Apache CXF JavaDoc 4.1.0-SNAPSHOT API)
Description: declaration: package: org.apache.cxf.interceptor.security, class: DefaultSecurityContext

Package org.apache.cxf.interceptor.security

# Class DefaultSecurityContext

java.lang.Object
org.apache.cxf.interceptor.security.DefaultSecurityContext

All Implemented Interfaces:
  `LoginSecurityContext`, `SecurityContext`

public class DefaultSecurityContext extends Object implements LoginSecurityContext
SecurityContext which implements isUserInRole using the following approach : skip the first Subject principal, and then checks Groups the principal is a member of

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `DefaultSecurityContext(String principalName, Subject subject)`
  `DefaultSecurityContext(Principal p, Subject subject)`
  `DefaultSecurityContext(Subject subject)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected boolean`
  `checkGroup(Principal principal, String role)`
  `Subject`
  `getSubject()`
  Returns the Subject representing the current authenticated user.
  `Principal`
  `getUserPrincipal()`
  `Set<Principal>`
  `getUserRoles()`
  Returns a set of Principals representing the roles assigned to the current authenticated user Principal
  `static boolean`
  `isGroupPrincipal(Principal principal)`
  `boolean`
  `isUserInRole(String role)`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### DefaultSecurityContext

    public DefaultSecurityContext(Subject subject)

  - ### DefaultSecurityContext

    public DefaultSecurityContext(String principalName, Subject subject)

  - ### DefaultSecurityContext

    public DefaultSecurityContext(Principal p, Subject subject)

- ## Method Details

  - ### getUserPrincipal

    public Principal getUserPrincipal()
    Specified by:
      `getUserPrincipal` in interface `SecurityContext`

  - ### isUserInRole

    public boolean isUserInRole(String role)
    Specified by:
      `isUserInRole` in interface `SecurityContext`

  - ### checkGroup

    protected boolean checkGroup(Principal principal, String role)

  - ### getSubject

    public Subject getSubject()
    Description copied from interface: `LoginSecurityContext`
    Returns the Subject representing the current authenticated user.
    Specified by:
      `getSubject` in interface `LoginSecurityContext`
    Returns:
      the subject

  - ### getUserRoles

    public Set<Principal> getUserRoles()
    Description copied from interface: `LoginSecurityContext`
    Returns a set of Principals representing the roles assigned to the current authenticated user Principal
    Specified by:
      `getUserRoles` in interface `LoginSecurityContext`
    Returns:
      the roles

  - ### isGroupPrincipal

    public static boolean isGroupPrincipal(Principal principal)