Sha256: a5db87b451331514825a9cec6ea75de582720bf9661167a971ed86b82997a0a0

Contents?: true

Size: 1.24 KB

Versions: 14

Compression:

Stored size: 1.24 KB

Contents

module Saml
  module Elements
    class StatusCode
      include Saml::Base

      tag "StatusCode"
      namespace 'samlp'

      attribute :value, String, tag: "Value"

      has_one :sub_status_code, Saml::Elements::SubStatusCode

      validates :value, presence: true, inclusion: TopLevelCodes::ALL

      def initialize(*args)
        options          = args.extract_options!
        @sub_status_code = Saml::Elements::SubStatusCode.new(value: options.delete(:sub_status_value)) if options[:sub_status_value]
        super(*(args << options))
      end

      def success?
        value == TopLevelCodes::SUCCESS
      end

      def authn_failed?
        sub_status_code.value == SubStatusCodes::AUTHN_FAILED
      end

      def request_denied?
        sub_status_code.value == SubStatusCodes::REQUEST_DENIED
      end

      def request_unsupported?
        sub_status_code.value == SubStatusCodes::REQUEST_UNSUPPORTED
      end

      def no_authn_context?
        sub_status_code.value == SubStatusCodes::NO_AUTHN_CONTEXT
      end

      def partial_logout?
        sub_status_code.value == SubStatusCodes::PARTIAL_LOGOUT
      end

      def unknown_principal?
        sub_status_code.value == SubStatusCodes::UNKNOWN_PRINCIPAL
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
libsaml-3.13.1 lib/saml/elements/status_code.rb
libsaml-3.13.0 lib/saml/elements/status_code.rb
libsaml-3.12.0 lib/saml/elements/status_code.rb
libsaml-3.11.0 lib/saml/elements/status_code.rb
libsaml-3.10.0 lib/saml/elements/status_code.rb
libsaml-3.9.3 lib/saml/elements/status_code.rb
libsaml-3.9.2 lib/saml/elements/status_code.rb
libsaml-3.9.1 lib/saml/elements/status_code.rb
libsaml-3.9.0 lib/saml/elements/status_code.rb
libsaml-3.8.0 lib/saml/elements/status_code.rb
libsaml-3.7.0 lib/saml/elements/status_code.rb
libsaml-3.6.0 lib/saml/elements/status_code.rb
libsaml-3.5.0 lib/saml/elements/status_code.rb
libsaml-3.4.0 lib/saml/elements/status_code.rb