Sha256: 245539e2efc9cde246d2c886f218b5d92f24dbfe5df622017e2658eaa8bfd0d2

Contents?: true

Size: 1.11 KB

Versions: 14

Compression:

Stored size: 1.11 KB

Contents

module Saml
  module ComplexTypes
    module AttributeType
      extend ActiveSupport::Concern
      include Saml::Base

      included do
        register_namespace "saml", Saml::SAML_NAMESPACE
        register_namespace 'ext',  Saml::ATTR_EXT_NAMESPACE

        attribute :name, String, tag: 'Name'
        attribute :format, String, tag: 'NameFormat'
        attribute :friendly_name, String, tag: 'FriendlyName'

        attribute :original_issuer, String, tag: 'ext:OriginalIssuer'
        attribute :last_modified, Time, tag: 'ext:LastModified', on_save: lambda { |val| val.utc.xmlschema if val.present? }

        has_many :attribute_values, Saml::Elements::AttributeValue

        validates :name, presence: true
      end

      def initialize(*args)
        options = args.extract_options!
        @attribute_values ||= []
        super(*(args << options))
      end

      def attribute_value=(value)
        attribute_value = if value.is_a? String
          Saml::Elements::AttributeValue.new(content: value)
        else
          value
        end
        self.attribute_values = [attribute_value]
      end

    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

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