Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| ModeShape Distribution 3.0.0.Alpha6
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.modeshape.jcr.security
Interface SecurityContext

All Known Implementing Classes:
  AnonymousProvider.AnonymousSecurityContext, JaasSecurityContext, ServletProvider.ServletSecurityContext

    @NotThreadSafe
    public interface SecurityContext

A security context provides a pluggable means to support disparate authentication and authorization mechanisms that specify the user name and roles.

A security context should only be associated with the execution context after authentication has occurred.

Method Summary
`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.

Method Detail

### isAnonymous

    boolean isAnonymous()

  Return whether this security context is an anonymous context.

  Returns:
    true if this context represents an anonymous user, or false otherwise

### getUserName

    String getUserName()

  Returns the authenticated user's name

  Returns:
    the authenticated user's name

### hasRole

    boolean hasRole(String roleName)

  Returns whether the authenticated user has the given role.

  Parameters:
    `roleName` - the name of the role to check
  Returns:
    true if the user has the role and is logged in; false otherwise

### logout

    void logout()

  Logs the user out of the authentication mechanism.

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

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| ModeShape Distribution 3.0.0.Alpha6
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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