Commit a3f93bd

mo <mo@mokhan.ca>
2017-11-02 16:28:11
remove service provider registry. (for now)
1 parent 879c039
lib/saml/kit/authentication_request.rb
@@ -1,9 +1,8 @@
 module Saml
   module Kit
     class AuthenticationRequest
-      def initialize(xml, registry = ServiceProviderRegistry.new)
+      def initialize(xml)
         @xml = xml
-        @registry = registry
         @hash = Hash.from_xml(@xml)
       end
 
@@ -19,10 +18,6 @@ module Saml
         @hash['AuthnRequest']['Issuer']
       end
 
-      def valid?
-        @registry.registered?(issuer)
-      end
-
       def to_xml
         @xml
       end
lib/saml/kit/service_provider_registry.rb
@@ -1,9 +0,0 @@
-module Saml
-  module Kit
-    class ServiceProviderRegistry
-      def registered?(issuer)
-        true
-      end
-    end
-  end
-end
lib/saml/kit.rb
@@ -15,7 +15,6 @@ require "saml/kit/namespaces"
 require "saml/kit/metadata"
 require "saml/kit/request"
 require "saml/kit/response"
-require "saml/kit/service_provider_registry"
 require "saml/kit/identity_provider_metadata"
 require "saml/kit/service_provider_metadata"
 require "saml/kit/signature"
spec/saml/authentication_request_spec.rb
@@ -1,8 +1,7 @@
 require 'spec_helper'
 
 RSpec.describe Saml::Kit::AuthenticationRequest do
-  subject { described_class.new(raw_xml, registry) }
-  let(:registry) { double }
+  subject { described_class.new(raw_xml) }
   let(:id) { SecureRandom.uuid }
   let(:acs_url) { "https://#{FFaker::Internet.domain_name}/acs" }
   let(:issuer) { FFaker::Movie.title }
@@ -19,18 +18,6 @@ RSpec.describe Saml::Kit::AuthenticationRequest do
   it { expect(subject.id).to eql("_#{id}") }
   it { expect(subject.acs_url).to eql(acs_url) }
 
-  describe "#valid?" do
-    it 'returns false when the service provider is not known' do
-      allow(registry).to receive(:registered?).with(issuer).and_return(false)
-      expect(subject).to_not be_valid
-    end
-
-    it 'returns true when the service provider is registered' do
-      allow(registry).to receive(:registered?).with(issuer).and_return(true)
-      expect(subject).to be_valid
-    end
-  end
-
 <<-EXAMPLE
 <samlp:AuthnRequest
   xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"