Class: RSAML::Identifier::Name

Inherits:
Base
  • Object
show all
Defined in:
lib/rsaml/identifier/name.rb

Overview

A Name identifier.

Direct Known Subclasses

Issuer

Instance Attribute Summary collapse

Attributes inherited from Base

#name_qualifier, #sp_name_qualifier

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ Name

Initialize the identifier with the given value



31
32
33
# File 'lib/rsaml/identifier/name.rb', line 31

def initialize(value)
  @value = value
end

Instance Attribute Details

#formatObject

The format of the name.



21
22
23
# File 'lib/rsaml/identifier/name.rb', line 21

def format
  @format
end

#sp_provided_idObject

A name identifier established by a service provider or affiliation of providers for the entity, if different from the primary name identifier given



25
26
27
# File 'lib/rsaml/identifier/name.rb', line 25

def sp_provided_id
  @sp_provided_id
end

#valueObject

The value of the identifier



28
29
30
# File 'lib/rsaml/identifier/name.rb', line 28

def value
  @value
end

Class Method Details

.formatsObject

The following identifiers MAY be used to refer to the classification of the attribute name for purposes of interpreting the name.



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/rsaml/identifier/name.rb', line 7

def self.formats
  {
    :unspecified => 'urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified',
    :email_address => 'urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress',
    :x509_subject_name => 'urn:oasis:names:tc:SAML:1.1:nameid-format:X509SubjectName',
    :windows_domain_qualified_name => 'urn:oasis:names:tc:SAML:1.1:nameid-format:WindowsDomainQualifiedName',
    :kerberos => 'urn:oasis:names:tc:SAML:2.0:nameid-format:kerberos',
    :entity => 'urn:oasis:names:tc:SAML:2.0:nameid-format:entity',
    :persistent => 'urn:oasis:names:tc:SAML:2.0:nameid-format:persistent',
    :transient => 'urn:oasis:names:tc:SAML:2.0:nameid-format:transient'
  }
end

.from_xml(element) ⇒ Object



49
50
51
# File 'lib/rsaml/identifier/name.rb', line 49

def self.from_xml(element)
  Name.new(element.text)
end

Instance Method Details

#to_xml(xml = Builder::XmlMarkup.new) ⇒ Object

Construct an XML fragment representing the name



41
42
43
44
45
46
47
# File 'lib/rsaml/identifier/name.rb', line 41

def to_xml(xml=Builder::XmlMarkup.new)
  attributes = {'Format' => format}
  attributes['NameQualifier'] = name_qualifier unless name_qualifier.nil?
  attributes['SPNameQualifier'] = sp_name_qualifier unless sp_name_qualifier.nil?
  attributes['SPProvidedID'] = sp_provided_id unless sp_provided_id.nil?
  xml.tag!('saml:NameID', value, attributes)
end