Sha256: 2f5a07083bb2a8edff4e31d066fc37eaa006fd9ff00b81195c6804d83b5249c9

Contents?: true

Size: 1.47 KB

Versions: 54

Compression:

Stored size: 1.47 KB

Contents

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

    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

54 entries across 54 versions & 1 rubygems

Version Path
libsaml-2.15.3 lib/saml/authn_request.rb
libsaml-2.15.2 lib/saml/authn_request.rb
libsaml-2.15.1 lib/saml/authn_request.rb
libsaml-2.14.0 lib/saml/authn_request.rb
libsaml-2.13.1 lib/saml/authn_request.rb
libsaml-2.12.1 lib/saml/authn_request.rb
libsaml-2.12.0 lib/saml/authn_request.rb
libsaml-2.11.2 lib/saml/authn_request.rb
libsaml-2.11.1 lib/saml/authn_request.rb
libsaml-2.11.0 lib/saml/authn_request.rb
libsaml-2.10.7 lib/saml/authn_request.rb
libsaml-2.10.6 lib/saml/authn_request.rb
libsaml-2.10.5 lib/saml/authn_request.rb
libsaml-2.10.4 lib/saml/authn_request.rb
libsaml-2.10.3 lib/saml/authn_request.rb
libsaml-2.10.2 lib/saml/authn_request.rb
libsaml-2.10.1 lib/saml/authn_request.rb
libsaml-2.10.0 lib/saml/authn_request.rb
libsaml-2.9.0 lib/saml/authn_request.rb
libsaml-2.8.1 lib/saml/authn_request.rb