class VerifyVspClient::FakeSso

A Rack application that can be used in the test suite to simulate the GOV.UK Verify SSO process.

The Rack app responds with a form that when submitted will POST back to `callback_path` with a `SAMLResponse` parameter set to `FakeSso::IDENTITY_VERIFIED_SAML_RESPONSE`.

Constants

IDENTITY_VERIFIED_SAML_RESPONSE

Public Class Methods

new(callback_path) click to toggle source
# File lib/verify_vsp_client/fake_sso.rb, line 11
def initialize(callback_path)
  @callback_path = callback_path
end

Public Instance Methods

call(env) click to toggle source
# File lib/verify_vsp_client/fake_sso.rb, line 15
def call(env)
  [200, {"Content-Type" => "text/html"}, [identity_verified_form]]
end

Private Instance Methods

identity_verified_form() click to toggle source
# File lib/verify_vsp_client/fake_sso.rb, line 21
    def identity_verified_form
      <<~HEREDOC
        <html><body>
          <form action="#{@callback_path}" method="POST" id="verify_auth_request">
            <input type="hidden" name="SAMLResponse" value="#{IDENTITY_VERIFIED_SAML_RESPONSE}">
            <input type="submit" value="Perform identity check">
          </form>
        </body></html>
      HEREDOC
    end