lib/saml/kit/authentication_request.rb in saml-kit-0.1.0 vs lib/saml/kit/authentication_request.rb in saml-kit-0.2.0

- old
+ new

@@ -1,21 +1,16 @@ module Saml module Kit class AuthenticationRequest < Document include Requestable - validates_presence_of :acs_url, if: :expected_type? def initialize(xml) super(xml, name: "AuthnRequest") end def acs_url - #if signed? && trusted? - to_h[name]['AssertionConsumerServiceURL'] || registered_acs_url(binding: :post) - #else - #registered_acs_url - #end + to_h[name]['AssertionConsumerServiceURL'] end def name_id_format to_h[name]['NameIDPolicy']['Format'] end @@ -24,15 +19,10 @@ Response::Builder.new(user, self) end private - def registered_acs_url(binding:) - return if provider.nil? - provider.assertion_consumer_service_for(binding: binding).try(:location) - end - class Builder attr_accessor :id, :now, :issuer, :acs_url, :name_id_format, :sign, :destination attr_accessor :version def initialize(configuration: Saml::Kit.configuration, sign: true) @@ -43,13 +33,13 @@ @version = "2.0" @sign = sign end def to_xml - Signature.sign(id, sign: sign) do |xml, signature| + Signature.sign(sign: sign) do |xml, signature| xml.tag!('samlp:AuthnRequest', request_options) do xml.tag!('saml:Issuer', issuer) - signature.template(xml) + signature.template(id) xml.tag!('samlp:NameIDPolicy', Format: name_id_format) end end end