Class: OmniAuth::Strategies::BisXmlEnvelope

Inherits:
ERB
  • Object
show all
Defined in:
lib/omniauth-nwbbis.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(body, options = {}) ⇒ BisXmlEnvelope

Returns a new instance of BisXmlEnvelope.



177
178
179
180
181
182
183
184
185
# File 'lib/omniauth-nwbbis.rb', line 177

def initialize(body, options = {})
    @body     = body
    @template = options.fetch(:template, self.class.template)

    @bis_user = options.fetch(:bis_user)
    @bis_password = options.fetch(:bis_password)

    super(@template)
end

Class Method Details

.templateObject



155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
# File 'lib/omniauth-nwbbis.rb', line 155

def self.template
    %{
            <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
              <s:Header>
                <o:Security s:mustUnderstand="1" xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
                    <u:Timestamp u:Id="_0">
                        <u:Created><%= Time.now.iso8601 %></u:Created>
                        <u:Expires><%= (Time.now + 5*60).iso8601 %></u:Expires>
                    </u:Timestamp>
                    <o:UsernameToken u:Id="uuid-b42663dd-caca-4fb4-b5f9-c65c34ac59b4-1">
                        <o:Username><%= @bis_user %></o:Username>
                        <o:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText"><%= @bis_password %></o:Password>
                    </o:UsernameToken>
                </o:Security>
              </s:Header>
              <s:Body>
                <%= @body %>
              </s:Body>
            </s:Envelope>
    }
end

Instance Method Details

#resultObject



187
188
189
# File 'lib/omniauth-nwbbis.rb', line 187

def result
    super(binding)
end