org.opensaml
Class SAMLNameIdentifier

java.lang.Object
  extended byorg.opensaml.SAMLObject
      extended byorg.opensaml.SAMLNameIdentifier
All Implemented Interfaces:
Cloneable

public class SAMLNameIdentifier
extends SAMLObject
implements Cloneable

Represents a SAML Subject

Author:
Scott Cantor

Field Summary
protected  String format
           
static String FORMAT_EMAIL
          Email Format Identifier
static String FORMAT_UNSPECIFIED
          Unspecified Format Identifier
static String FORMAT_WINDOWS
          Windows Domain Format Identifier
static String FORMAT_X509
          X.509 Subject Format Identifier
protected static Hashtable formatMap
          Maps formats to Java class implementations
protected  String name
           
protected  String nameQualifier
           
 
Fields inherited from class org.opensaml.SAMLObject
config, dirty, log, parentObject, root
 
Constructor Summary
SAMLNameIdentifier()
          Default constructor
SAMLNameIdentifier(Element e)
          Reconstructs a name identifier from a DOM tree
SAMLNameIdentifier(InputStream in)
          Reconstructs a name identifier from a stream
SAMLNameIdentifier(String name, String nameQualifier, String format)
          Builds a name identifier out of its component parts
 
Method Summary
protected  Element buildRoot(Document doc, boolean xmlns)
          Delegates the process of building the root element of an object and inserting appropriate namespaces.
 void checkValidity()
          Evaluates the object's content to see if it is currently valid if serialized.
 Object clone()
          Copies a SAML object such that no dependencies exist between the original and the copy
 void fromDOM(Element e)
          Initialization of an object from a DOM element
 String getFormat()
          Gets the format of the name
static SAMLNameIdentifier getInstance(Element e)
          Locates an implementation class for a NameIdentifier based on Format and constructs it based on the DOM provided.
static SAMLNameIdentifier getInstance(InputStream in)
          Locates an implementation class for a NameIdentifier based on Format and constructs it based on the stream provided.
static SAMLNameIdentifier getInstance(String format)
          Locates an implementation class for a NameIdentifier based on Format and constructs an empty instance.
 String getName()
          Gets the name of the Subject
 String getNameQualifier()
          Gets the name qualifier
static void regFactory(String format, String className)
          Registers a class to handle a specific NameID format when parsing XML
 void setFormat(String format)
          Sets the format of the name
 void setName(String name)
          Sets the name of the Subject
 void setNameQualifier(String nameQualifier)
          Sets the name qualifier
 Node toDOM(Document doc, boolean xmlns)
          Transforms the object into a DOM tree using an existing document context
static void unregFactory(String format)
          Unregisters a class to handle a specific NameID format when parsing XML
 
Methods inherited from class org.opensaml.SAMLObject
fromStream, fromStream, getParent, plantRoot, setDirty, setParent, toBase64, toDOM, toDOM, toDOM, toStream, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

name

protected String name

nameQualifier

protected String nameQualifier

format

protected String format

formatMap

protected static Hashtable formatMap
Maps formats to Java class implementations


FORMAT_UNSPECIFIED

public static final String FORMAT_UNSPECIFIED
Unspecified Format Identifier

See Also:
Constant Field Values

FORMAT_EMAIL

public static final String FORMAT_EMAIL
Email Format Identifier

See Also:
Constant Field Values

FORMAT_X509

public static final String FORMAT_X509
X.509 Subject Format Identifier

See Also:
Constant Field Values

FORMAT_WINDOWS

public static final String FORMAT_WINDOWS
Windows Domain Format Identifier

See Also:
Constant Field Values
Constructor Detail

SAMLNameIdentifier

public SAMLNameIdentifier()
Default constructor


SAMLNameIdentifier

public SAMLNameIdentifier(String name,
                          String nameQualifier,
                          String format)
                   throws SAMLException
Builds a name identifier out of its component parts

Parameters:
name - Name of subject (optional)
nameQualifier - Federates or qualifies subject name (optional)
format - URI describing name semantics and format (optional)
Throws:
SAMLException - Raised if a name cannot be constructed from the supplied information

SAMLNameIdentifier

public SAMLNameIdentifier(Element e)
                   throws SAMLException
Reconstructs a name identifier from a DOM tree

Parameters:
e - The root of a DOM tree
Throws:
SAMLException - Thrown if the object cannot be constructed

SAMLNameIdentifier

public SAMLNameIdentifier(InputStream in)
                   throws SAMLException
Reconstructs a name identifier from a stream

Parameters:
in - A stream containing XML
Throws:
SAMLException - Raised if an exception occurs while constructing the object.
Method Detail

regFactory

public static void regFactory(String format,
                              String className)
Registers a class to handle a specific NameID format when parsing XML

Parameters:
format - The format URI to register
className - The Java class that handles this format

unregFactory

public static void unregFactory(String format)
Unregisters a class to handle a specific NameID format when parsing XML


getInstance

public static SAMLNameIdentifier getInstance(Element e)
                                      throws SAMLException
Locates an implementation class for a NameIdentifier based on Format and constructs it based on the DOM provided.

Parameters:
e - The root of a DOM containing the SAML condition
Returns:
SAMLNameIdentifier A constructed NameIdentifier object
Throws:
SAMLException - Thrown if an error occurs while constructing the object

getInstance

public static SAMLNameIdentifier getInstance(InputStream in)
                                      throws SAMLException
Locates an implementation class for a NameIdentifier based on Format and constructs it based on the stream provided.

Parameters:
in - The stream to deserialize from
Returns:
SAMLNameIdentifier A constructed NameIdentifier object
Throws:
SAMLException - Thrown if an error occurs while constructing the object

getInstance

public static SAMLNameIdentifier getInstance(String format)
                                      throws SAMLException
Locates an implementation class for a NameIdentifier based on Format and constructs an empty instance.

Parameters:
format - The format, indicating which implementation class to use
Returns:
SAMLNameIdentifier A constructed NameIdentifier object
Throws:
SAMLException - Thrown if an error occurs while constructing the object

fromDOM

public void fromDOM(Element e)
             throws SAMLException
Description copied from class: SAMLObject
Initialization of an object from a DOM element

Overrides:
fromDOM in class SAMLObject
Parameters:
e - Root element of a DOM tree
Throws:
SAMLException - Raised if an exception occurs while constructing the object
See Also:
SAMLObject.fromDOM(org.w3c.dom.Element)

getName

public String getName()
Gets the name of the Subject

Returns:
The Subject name

setName

public void setName(String name)
Sets the name of the Subject

Parameters:
name - The name

getNameQualifier

public String getNameQualifier()
Gets the name qualifier

Returns:
The name qualifier

setNameQualifier

public void setNameQualifier(String nameQualifier)
Sets the name qualifier

Parameters:
nameQualifier - The name qualifier

getFormat

public String getFormat()
Gets the format of the name

Returns:
The name format URI

setFormat

public void setFormat(String format)
Sets the format of the name

Parameters:
format - The name format URI

buildRoot

protected Element buildRoot(Document doc,
                            boolean xmlns)
Description copied from class: SAMLObject
Delegates the process of building the root element of an object and inserting appropriate namespaces.

Specified by:
buildRoot in class SAMLObject
Parameters:
doc - The document context to use
xmlns - Include namespace(s) on root element?
Returns:
A new root element for the object
See Also:
SAMLObject.buildRoot(org.w3c.dom.Document,boolean)

toDOM

public Node toDOM(Document doc,
                  boolean xmlns)
           throws SAMLException
Description copied from class: SAMLObject
Transforms the object into a DOM tree using an existing document context

Overrides:
toDOM in class SAMLObject
Parameters:
doc - A Document object to use in manufacturing the tree
xmlns - Include namespace(s) on root element?
Returns:
Root element node of the DOM tree capturing the object
Throws:
SAMLException - Raised if the object is incompletely defined
See Also:
SAMLObject.toDOM(org.w3c.dom.Document,boolean)

checkValidity

public void checkValidity()
                   throws SAMLException
Description copied from class: SAMLObject
Evaluates the object's content to see if it is currently valid if serialized. Does not evaluate embedded objects except on the basis of whether they exist. For example, an Assertion must have a Statement, but if an invalid statement is added, SAMLAssertion.checkValidity() would succeed, while SAMLStatement.checkValidity would raise an exception.

Specified by:
checkValidity in class SAMLObject
Throws:
SAMLException - Raised if the serialized object would be invalid SAML, excluding any embedded objects
See Also:
SAMLObject.checkValidity()

clone

public Object clone()
             throws CloneNotSupportedException
Copies a SAML object such that no dependencies exist between the original and the copy

Overrides:
clone in class SAMLObject
Returns:
The new object
Throws:
CloneNotSupportedException
See Also:
Object.clone()


Copyright ? 2005 UCAID. All Rights Reserved.