Sha256: 418036c03f0e2ba42979b9fac22e20141c623bcc71b83f627ddbb37bed48e333

Contents?: true

Size: 1.5 KB

Versions: 40

Compression:

Stored size: 1.5 KB

Contents

module Saml
  class AuthnRequest
    include Saml::ComplexTypes::RequestAbstractType

    attr_accessor :xml_value

    tag 'AuthnRequest'
    attribute :force_authn, Boolean, :tag => "ForceAuthn"
    attribute :is_passive, Boolean, :tag => "IsPassive"
    attribute :assertion_consumer_service_index, Integer, :tag => "AssertionConsumerServiceIndex"
    attribute :assertion_consumer_service_url, String, :tag => "AssertionConsumerServiceURL"
    attribute :attribute_consuming_service_index, Integer, :tag => "AttributeConsumingServiceIndex"
    attribute :protocol_binding, String, :tag => "ProtocolBinding"
    attribute :provider_name, String, :tag => "ProviderName"

    has_one :requested_authn_context, Saml::Elements::RequestedAuthnContext

    validates :force_authn, :inclusion => [true, false, nil]
    validates :assertion_consumer_service_index, :numericality => true, :if => "assertion_consumer_service_index.present?"

    validate :check_assertion_consumer_service

    def assertion_url
      return assertion_consumer_service_url if assertion_consumer_service_url
      provider.assertion_consumer_service_url(assertion_consumer_service_index) if assertion_consumer_service_index
    end

    private

    def check_assertion_consumer_service
      if assertion_consumer_service_index.present?
        errors.add(:assertion_consumer_service_url, :must_be_blank) if @assertion_consumer_service_url.present?
        errors.add(:protocol_binding, :must_be_blank) if protocol_binding.present?
      end
    end
  end
end

Version data entries

40 entries across 40 versions & 1 rubygems

Version Path
libsaml-2.24.3 lib/saml/authn_request.rb
libsaml-2.24.2 lib/saml/authn_request.rb
libsaml-3.0.2 lib/saml/authn_request.rb
libsaml-3.0.1 lib/saml/authn_request.rb
libsaml-2.24.1 lib/saml/authn_request.rb
libsaml-2.23.2 lib/saml/authn_request.rb
libsaml-2.23.1 lib/saml/authn_request.rb
libsaml-2.22.2 lib/saml/authn_request.rb
libsaml-2.22.1 lib/saml/authn_request.rb
libsaml-2.22.0 lib/saml/authn_request.rb
libsaml-2.21.3 lib/saml/authn_request.rb
libsaml-2.21.2 lib/saml/authn_request.rb
libsaml-2.21.1 lib/saml/authn_request.rb
libsaml-2.21.0 lib/saml/authn_request.rb
libsaml-2.20.6 lib/saml/authn_request.rb
libsaml-2.20.5 lib/saml/authn_request.rb
libsaml-2.20.4 lib/saml/authn_request.rb
libsaml-2.20.3 lib/saml/authn_request.rb
libsaml-2.20.2 lib/saml/authn_request.rb
libsaml-2.20.1 lib/saml/authn_request.rb