Class: SAML2::Endpoint

Inherits:
Base
  • Object
show all
Defined in:
lib/saml2/endpoint.rb

Direct Known Subclasses

Indexed

Defined Under Namespace

Modules: ChoiceHelpers Classes: Array, Indexed

Instance Attribute Summary collapse

Attributes inherited from Base

#xml

Instance Method Summary collapse

Methods inherited from Base

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

Constructor Details

#initialize(location = nil, binding = Bindings::HTTP_POST::URN, response_location = nil) ⇒ Endpoint

Returns a new instance of Endpoint.

Parameters:

  • location (String) (defaults to: nil)
  • binding (String) (defaults to: Bindings::HTTP_POST::URN)
  • response_location (String, nil) (defaults to: nil)

101
102
103
104
105
106
# File 'lib/saml2/endpoint.rb', line 101

def initialize(location = nil, binding = Bindings::HTTP_POST::URN, response_location = nil)
  super()
  @location = location
  @binding = binding
  @response_location = response_location
end

Instance Attribute Details

#bindingString

Returns:

  • (String)

94
95
96
# File 'lib/saml2/endpoint.rb', line 94

def binding
  @binding
end

#locationString

Returns:

  • (String)

94
95
96
# File 'lib/saml2/endpoint.rb', line 94

def location
  @location
end

#response_locationString?

Returns:

  • (String, nil)

96
97
98
# File 'lib/saml2/endpoint.rb', line 96

def response_location
  @response_location
end

Instance Method Details

#==(other) ⇒ Boolean

Parameters:

Returns:

  • (Boolean)

110
111
112
113
# File 'lib/saml2/endpoint.rb', line 110

def ==(other)
  other.is_a?(Endpoint) &&
    location == other.location && binding == other.binding && response_location == other.response_location
end

#build(builder, element) ⇒ void

This method returns an undefined value.

Serialize this object to XML, as part of a larger document

Parameters:

  • builder (Nokogiri::XML::Builder)

    The builder helper object to serialize to.


124
125
126
127
128
# File 'lib/saml2/endpoint.rb', line 124

def build(builder, element)
  builder["md"].__send__(element, "Location" => location, "Binding" => binding) do |b|
    b.ResponseLocation = response_location if response_location
  end
end

#effective_response_locationString

@!attribute The #response_location if there is one, otherwise the #location

Returns:

  • (String)

133
134
135
# File 'lib/saml2/endpoint.rb', line 133

def effective_response_location
  response_location || location
end

#from_xml(node) ⇒ void

This method returns an undefined value.

Parse an XML element into this object.

Parameters:

  • node (Nokogiri::XML::Element)

116
117
118
119
120
121
# File 'lib/saml2/endpoint.rb', line 116

def from_xml(node)
  super
  @location = node["Location"]
  @binding = node["Binding"]
  @response_location = node["ResponseLocation"]
end

#inspectString

Returns:

  • (String)

138
139
140
# File 'lib/saml2/endpoint.rb', line 138

def inspect
  "#<SAML2::Endpoint #{endpoint_inspect}>"
end