Sha256: 4a458cfba6d685d42c7391104a48a9c33b4ae620b26c411e5ad822d89c191d03

Contents?: true

Size: 1.4 KB

Versions: 9

Compression:

Stored size: 1.4 KB

Contents

require_relative '../spec_helper'

module SAML2
  describe IdentityProvider do
    it "should serialize valid xml" do
      entity = Entity.new
      entity.entity_id = 'http://sso.canvaslms.com/SAML2'
      entity.organization = Organization.new('Canvas', 'Canvas by Instructure', 'https://www.canvaslms.com/')
      contact = Contact.new(Contact::Type::TECHNICAL)
      contact.company = 'Instructure'
      contact.email_addresses << 'mailto:ops@instructure.com'
      entity.contacts << contact

      idp = IdentityProvider.new
      idp.name_id_formats << NameID::Format::PERSISTENT
      idp.single_sign_on_services << Endpoint.new('https://sso.canvaslms.com/SAML2/Login')
      idp.keys << Key.new('somedata', Key::Type::SIGNING)

      entity.roles << idp
      expect(Schemas.metadata.validate(Nokogiri::XML(entity.to_s))).to eq []
    end

    describe "valid metadata" do
      let(:entity) { Entity.parse(fixture('identity_provider.xml')) }
      let(:idp) { entity.roles.first }

      it "should create the single_sign_on_services array" do
        expect(idp.single_sign_on_services.length).to eq 3
        expect(idp.single_sign_on_services.first.location).to eq 'https://sso.school.edu/idp/profile/Shibboleth/SSO'
      end

      it "should find the signing certificate" do
        expect(idp.keys.first.x509).to match(/MIIE8TCCA9mgAwIBAgIJAITusxON60cKMA0GCSqGSIb3DQEBBQUAMIGrMQswCQYD/)
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
saml2-2.0.2 spec/lib/identity_provider_spec.rb
saml2-2.0.1 spec/lib/identity_provider_spec.rb
saml2-2.0.0 spec/lib/identity_provider_spec.rb
saml2-1.1.5 spec/lib/identity_provider_spec.rb
saml2-1.1.4 spec/lib/identity_provider_spec.rb
saml2-1.1.3 spec/lib/identity_provider_spec.rb
saml2-1.1.2 spec/lib/identity_provider_spec.rb
saml2-1.1.1 spec/lib/identity_provider_spec.rb
saml2-1.1.0 spec/lib/identity_provider_spec.rb