org.modeshape.jcr.api

## Class AnonymousCredentials

- java.lang.Object
- - org.modeshape.jcr.api.AnonymousCredentials

- All Implemented Interfaces:
    Serializable, Credentials

      public class AnonymousCredentials
      extends Object
      implements Credentials

  A `Credentials` implementation that can be used to represent anonymous users when ModeShape is configured to allow anonymous users.

  Note that this implementation supports attributes.

  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `AnonymousCredentials()` Create a new instance of the anonymous credentials.
    `AnonymousCredentials(String attributeName, Object attributeValue)` Create a new instance of the anonymous credentials, with the supplied attributes.
    `AnonymousCredentials(String attribute1Name, Object attribute1Value, String attribute2Name, Object attribute2Value)` Create a new instance of the anonymous credentials, with the supplied attributes.
    `AnonymousCredentials(String attribute1Name, Object attribute1Value, String attribute2Name, Object attribute2Value, String attribute3Name, Object attribute3Value)` Create a new instance of the anonymous credentials, with the supplied attributes.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Object` | `getAttribute(String name)` Returns the value of the named attribute as an `Object`, or `null` if no attribute of the given name exists.
    `String[]` | `getAttributeNames()` Returns the names of the attributes available to this credentials instance.
    `Map<String,Object>` | `getAttributes()`
    `void` | `removeAttribute(String name)` Removes an attribute from this credentials instance.
    `void` | `setAttribute(String name, Object value)` Stores an attribute in this credentials instance.

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

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

- - ### Constructor Detail

    - #### AnonymousCredentials

          public AnonymousCredentials()

      Create a new instance of the anonymous credentials.

    - #### AnonymousCredentials

          public AnonymousCredentials(String attributeName,
                              Object attributeValue)

      Create a new instance of the anonymous credentials, with the supplied attributes.
      Parameters:
        `attributeName` - the name of the attribute; may not be null
        `attributeValue` - the value of the attribute

    - #### AnonymousCredentials

          public AnonymousCredentials(String attribute1Name,
                              Object attribute1Value,
                              String attribute2Name,
                              Object attribute2Value)

      Create a new instance of the anonymous credentials, with the supplied attributes.
      Parameters:
        `attribute1Name` - the name of the attribute; may not be null
        `attribute1Value` - the value of the attribute
        `attribute2Name` - the name of the attribute; may not be null
        `attribute2Value` - the value of the attribute

    - #### AnonymousCredentials

          public AnonymousCredentials(String attribute1Name,
                              Object attribute1Value,
                              String attribute2Name,
                              Object attribute2Value,
                              String attribute3Name,
                              Object attribute3Value)

      Create a new instance of the anonymous credentials, with the supplied attributes.
      Parameters:
        `attribute1Name` - the name of the attribute; may not be null
        `attribute1Value` - the value of the attribute
        `attribute2Name` - the name of the attribute; may not be null
        `attribute2Value` - the value of the attribute
        `attribute3Name` - the name of the attribute; may not be null
        `attribute3Value` - the value of the attribute

  - ### Method Detail

    - #### setAttribute

          public void setAttribute(String name,
                          Object value)

      Stores an attribute in this credentials instance.
      Parameters:
        `name` - a `String` specifying the name of the attribute
        `value` - the `Object` to be stored

    - #### getAttribute

          public Object getAttribute(String name)

      Returns the value of the named attribute as an `Object`, or `null` if no attribute of the given name exists.
      Parameters:
        `name` - a `String` specifying the name of the attribute
      Returns:
        an `Object` containing the value of the attribute, or `null` if the attribute does not exist

    - #### removeAttribute

          public void removeAttribute(String name)

      Removes an attribute from this credentials instance.
      Parameters:
        `name` - a `String` specifying the name of the attribute to remove

    - #### getAttributeNames

          public String[] getAttributeNames()

      Returns the names of the attributes available to this credentials instance. This method returns an empty array if the credentials instance has no attributes available to it.
      Returns:
        a string array containing the names of the stored attributes

    - #### getAttributes

          public Map<String,Object> getAttributes()

      Returns:
        attributes

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