Sha256: 36e45991879704a23d5cd94c4114d810070362ea161a6f01ff8dbc7887061fdc

Contents?: true

Size: 1.31 KB

Versions: 24

Compression:

Stored size: 1.31 KB

Contents

require_relative './principal'

RSpec.describe "Logout Request" do
  let(:user) { Principal.new(id: SecureRandom.uuid, email: "hello@example.com") }

  it 'produces a SAMLRequest' do
    xml = Saml::Kit::Metadata.build_xml do |builder|
      builder.contact_email = 'hi@example.com'
      builder.organization_name = "Acme, Inc"
      builder.organization_url = 'https://www.example.com'
      builder.build_identity_provider do |x|
        x.add_single_sign_on_service('https://www.example.com/login', binding: :http_post)
        x.add_single_sign_on_service('https://www.example.com/login', binding: :http_redirect)
        x.add_single_logout_service('https://www.example.com/logout', binding: :http_post)
        x.name_id_formats = [ Saml::Kit::Namespaces::EMAIL_ADDRESS ]
        x.attributes << :id
        x.attributes << :email
      end
      builder.build_service_provider do |x|
        x.add_assertion_consumer_service('https://www.example.com/consume', binding: :http_post)
        x.add_single_logout_service('https://www.example.com/logout', binding: :http_post)
      end
    end

    sp = Saml::Kit::IdentityProviderMetadata.new(xml)
    url, saml_params = sp.logout_request_for(user, binding: :http_post)
    expect(url).to eql("https://www.example.com/logout")
    expect(saml_params['SAMLRequest']).to be_present
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
saml-kit-1.3.0 spec/examples/logout_request_spec.rb
saml-kit-1.2.0 spec/examples/logout_request_spec.rb
saml-kit-1.1.0 spec/examples/logout_request_spec.rb
saml-kit-1.0.31 spec/examples/logout_request_spec.rb
saml-kit-1.0.30 spec/examples/logout_request_spec.rb
saml-kit-1.0.29 spec/examples/logout_request_spec.rb
saml-kit-1.0.28 spec/examples/logout_request_spec.rb
saml-kit-1.0.27 spec/examples/logout_request_spec.rb
saml-kit-1.0.26 spec/examples/logout_request_spec.rb
saml-kit-1.0.25 spec/examples/logout_request_spec.rb
saml-kit-1.0.24 spec/examples/logout_request_spec.rb
saml-kit-1.0.23 spec/examples/logout_request_spec.rb
saml-kit-1.0.22 spec/examples/logout_request_spec.rb
saml-kit-1.0.21 spec/examples/logout_request_spec.rb
saml-kit-1.0.20 spec/examples/logout_request_spec.rb
saml-kit-1.0.19 spec/examples/logout_request_spec.rb
saml-kit-1.0.18 spec/examples/logout_request_spec.rb
saml-kit-1.0.17 spec/examples/logout_request_spec.rb
saml-kit-1.0.16 spec/examples/logout_request_spec.rb
saml-kit-1.0.15 spec/examples/logout_request_spec.rb