org.modeshape.jcr.security

## Class AnonymousProvider.AnonymousSecurityContext

- java.lang.Object
- - org.modeshape.jcr.security.AnonymousProvider.AnonymousSecurityContext

- All Implemented Interfaces:
    SecurityContext
  Enclosing class:
    AnonymousProvider

      protected final class AnonymousProvider.AnonymousSecurityContext
      extends Object
      implements SecurityContext

- - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `AnonymousProvider.AnonymousSecurityContext(Set<String> userRoles, String anonymousUsername)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `getUserName()` Returns the authenticated user's name
    `boolean` | `hasRole(String roleName)` Returns whether the authenticated user has the given role.
    `boolean` | `isAnonymous()` Return whether this security context is an anonymous context.
    `void` | `logout()` Logs the user out of the authentication mechanism.

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

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

- - ### Constructor Detail

    - #### AnonymousProvider.AnonymousSecurityContext

          protected AnonymousProvider.AnonymousSecurityContext(Set<String> userRoles,
                                                    String anonymousUsername)

  - ### Method Detail

    - #### isAnonymous

          public boolean isAnonymous()

      Description copied from interface: `SecurityContext`
      Return whether this security context is an anonymous context.
      Specified by:
        `isAnonymous` in interface `SecurityContext`
      Returns:
        true if this context represents an anonymous user, or false otherwise

    - #### getUserName

          public String getUserName()

      Description copied from interface: `SecurityContext`
      Returns the authenticated user's name
      Specified by:
        `getUserName` in interface `SecurityContext`
      Returns:
        the authenticated user's name

    - #### hasRole

          public boolean hasRole(String roleName)

      Description copied from interface: `SecurityContext`
      Returns whether the authenticated user has the given role.
      Specified by:
        `hasRole` in interface `SecurityContext`
      Parameters:
        `roleName` - the name of the role to check
      Returns:
        true if the user has the role and is logged in; false otherwise

    - #### logout

          public void logout()

      Description copied from interface: `SecurityContext`
      Logs the user out of the authentication mechanism.

      For some authentication mechanisms, this will be implemented as a no-op.

      Specified by:
        `logout` in interface `SecurityContext`

Copyright © 2008-2014 JBoss, a division of Red Hat. All Rights Reserved.