Class: SAML2::RequestedAttribute

Inherits:
Attribute show all
Defined in:
lib/saml2/attribute_consuming_service.rb

Instance Attribute Summary

Attributes inherited from Attribute

#friendly_name, #name, #name_format, #value

Attributes inherited from Base

#xml

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Attribute

#build, from_xml

Methods inherited from Base

#build, #decrypt, from_xml, #inspect, load_object_array, load_string_array, lookup_qname, #to_s, #to_xml

Constructor Details

#initialize(name = nil, is_required = nil, friendly_name = nil, name_format = nil) ⇒ RequestedAttribute

Parameters:

  • name (String) (defaults to: nil)
  • is_required (defaults to: nil)

    optional [true, false, nil]

  • friendly_name (defaults to: nil)

    optional [String, nil]

  • name_format (defaults to: nil)

    optional [String, nil]



46
47
48
49
# File 'lib/saml2/attribute_consuming_service.rb', line 46

def initialize(name = nil, is_required = nil, friendly_name = nil, name_format = nil)
  super(name, nil, friendly_name, name_format)
  @is_required = is_required
end

Class Method Details

.create(name, is_required = nil) ⇒ RequestedAttribute

Create a RequestAttribute object to represent an attribute.

Attribute.create will be used to create a temporary object, so that attribute-class specific inferences (i.e. Attribute::X500 friendly names) will be done, but always returns a SAML2::RequestedAttribute.

Parameters:

  • name (String)

    The attribute name. This can be a friendly name, or a URI.

  • is_required (defaults to: nil)

    optional [true, false, nil]

Returns:



34
35
36
37
# File 'lib/saml2/attribute_consuming_service.rb', line 34

def create(name, is_required = nil)
  attribute = Attribute.create(name)
  new(attribute.name, is_required, attribute.friendly_name, attribute.name_format)
end

.element'RequestedAttribute'

The XML element that this attribute class serializes as.

Returns:



21
22
23
# File 'lib/saml2/attribute_consuming_service.rb', line 21

def element
  'RequestedAttribute'
end

.namespace'md'

The XML namespace that this attribute class serializes as.

Returns:

  • ('md')


15
16
17
# File 'lib/saml2/attribute_consuming_service.rb', line 15

def namespace
  'md'
end

Instance Method Details

#from_xml(node) ⇒ void

This method returns an undefined value.

Parse an XML element into this object.

Parameters:

  • node (Nokogiri::XML::Element)


52
53
54
55
# File 'lib/saml2/attribute_consuming_service.rb', line 52

def from_xml(node)
  super
  @is_required = node['isRequired'] && node['isRequired'] == 'true'
end

#required?true, ...

Returns:

  • (true, false, nil)


58
59
60
# File 'lib/saml2/attribute_consuming_service.rb', line 58

def required?
  @is_required
end