Class: SAML2::Attribute::X500
- Inherits:
-
SAML2::Attribute
- Object
- Base
- SAML2::Attribute
- SAML2::Attribute::X500
- Defined in:
- lib/saml2/attribute/x500.rb
Defined Under Namespace
Modules: EduPerson, InetOrgPerson
Constant Summary collapse
- GIVEN_NAME =
'urn:oid:2.5.4.42'.freeze
- SN =
SURNAME = 'urn:oid:2.5.4.4'.freeze
- UID =
USERID = 'urn:oid:0.9.2342.19200300.100.1.1'.freeze
- MAIL =
'urn:oid:0.9.2342.19200300.100.1.3'.freeze
Instance Attribute Summary
Attributes inherited from SAML2::Attribute
#friendly_name, #name, #name_format, #value
Attributes inherited from Base
Class Method Summary collapse
Instance Method Summary collapse
- #build(builder) ⇒ Object
-
#initialize(name = nil, value = nil) ⇒ X500
constructor
A new instance of X500.
Methods inherited from SAML2::Attribute
create, #from_xml, from_xml, inherited, subclasses
Methods inherited from Base
from_xml, #from_xml, load_object_array, load_string_array, lookup_qname, #to_s, #to_xml
Constructor Details
#initialize(name = nil, value = nil) ⇒ X500
Returns a new instance of X500.
40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/saml2/attribute/x500.rb', line 40 def initialize(name = nil, value = nil) # if they pass an OID, infer the friendly name friendly_name = OIDS[name] unless friendly_name # if they pass a friendly name, infer the OID proper_name = FRIENDLY_NAMES[name] if proper_name name, friendly_name = proper_name, name end end super(name, value, friendly_name, NameFormats::URI) end |
Class Method Details
.recognizes?(name_or_node) ⇒ Boolean
32 33 34 35 36 37 38 |
# File 'lib/saml2/attribute/x500.rb', line 32 def self.recognizes?(name_or_node) if name_or_node.is_a?(Nokogiri::XML::Element) !!name_or_node.at_xpath("@x500:Encoding", Namespaces::ALL) else FRIENDLY_NAMES.include?(name_or_node) || OIDS.include?(name_or_node) end end |
Instance Method Details
#build(builder) ⇒ Object
54 55 56 57 58 59 |
# File 'lib/saml2/attribute/x500.rb', line 54 def build(builder) super attr = builder.parent.last_element_child attr.add_namespace_definition('x500', Namespaces::X500) attr['x500:Encoding'] = 'LDAP' end |