Class: ADAL::MexResponse

Inherits:
Object
  • Object
show all
Extended by:
Logging
Includes:
XmlNamespaces
Defined in:
lib/adal/mex_response.rb

Overview

Relevant fields from a Mex response.

Defined Under Namespace

Classes: MexError

Constant Summary collapse

POLICY_ID_XPATH =
'//wsdl:definitions/wsp:Policy[./wsp:ExactlyOne/wsp:All/sp:SignedSuppor' \
'tingTokens/wsp:Policy/sp:UsernameToken/wsp:Policy/sp:WssUsernameToken1' \
'0]/@u:Id|//wsdl:definitions/wsp:Policy[./wsp:ExactlyOne/wsp:All/ssp:Si' \
'gnedEncryptedSupportingTokens/wsp:Policy/ssp:UsernameToken/wsp:Policy/' \
'ssp:WssUsernameToken10]/@u:Id'
BINDING_XPATH =
'//wsdl:definitions/wsdl:binding[./wsp:PolicyReference]'
PORT_XPATH =
'//wsdl:definitions/wsdl:service/wsdl:port'
ADDRESS_XPATH =
'./soap12:address/@location'

Constants included from Logging

Logging::DEFAULT_LOG_LEVEL, Logging::DEFAULT_LOG_OUTPUT

Constants included from XmlNamespaces

XmlNamespaces::ACTION_TO_NAMESPACE, XmlNamespaces::BINDING_TO_ACTION, XmlNamespaces::NAMESPACES, XmlNamespaces::NAMESPACES_13, XmlNamespaces::NAMESPACES_2005, XmlNamespaces::WSTRUST_13, XmlNamespaces::WSTRUST_2005

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Logging

logger

Constructor Details

#initialize(wstrust_url, binding) ⇒ MexResponse

Constructs a new MexResponse.



134
135
136
137
138
139
# File 'lib/adal/mex_response.rb', line 134

def initialize(wstrust_url, binding)
  @action = BINDING_TO_ACTION[binding]
  @wstrust_url = URI.parse(wstrust_url.to_s)
  return if @wstrust_url.instance_of? URI::HTTPS
  fail ArgumentError, 'Mex is only done over HTTPS.'
end

Instance Attribute Details

#actionObject (readonly)

Returns the value of attribute action.



126
127
128
# File 'lib/adal/mex_response.rb', line 126

def action
  @action
end

#wstrust_urlObject (readonly)

Returns the value of attribute wstrust_url.



127
128
129
# File 'lib/adal/mex_response.rb', line 127

def wstrust_url
  @wstrust_url
end

Class Method Details

.parse(response) ⇒ Object

Parses the XML string response from the Metadata Exchange endpoint into a MexResponse object.



56
57
58
59
60
61
62
# File 'lib/adal/mex_response.rb', line 56

def self.parse(response)
  xml = Nokogiri::XML(response)
  policy_ids = parse_policy_ids(xml)
  bindings = parse_bindings(xml, policy_ids)
  endpoint, binding = parse_endpoint_and_binding(xml, bindings)
  MexResponse.new(endpoint, binding)
end