class Saml::Elements::Subject

Public Class Methods

new(*args) click to toggle source
Calls superclass method
# File lib/saml/elements/subject.rb, line 18
def initialize(*args)
  options               = args.extract_options!
  if options[:name_id].present?
    @_name_id             = Saml::Elements::NameId.new(format: options.delete(:name_id_format),
                                                       value:  options.delete(:name_id))
  end
  @subject_confirmations = [Saml::Elements::SubjectConfirmation.new(recipient:      options.delete(:recipient),
                                                                    in_response_to: options.delete(:in_response_to))]
  super(*(args << options))
end

Public Instance Methods

name_id() click to toggle source
# File lib/saml/elements/subject.rb, line 29
def name_id
  @_name_id.try(:value)
end
name_id=(value) click to toggle source
# File lib/saml/elements/subject.rb, line 33
def name_id=(value)
  @_name_id.value = value if @_name_id
end
name_id_format() click to toggle source
# File lib/saml/elements/subject.rb, line 37
def name_id_format
  @_name_id.try(:format)
end
subject_confirmation() click to toggle source
# File lib/saml/elements/subject.rb, line 41
def subject_confirmation
  subject_confirmations.first
end
subject_confirmation=(subject_confirmation) click to toggle source
# File lib/saml/elements/subject.rb, line 45
def subject_confirmation=(subject_confirmation)
  self.subject_confirmations = [subject_confirmation]
end

Private Instance Methods

check_identifier() click to toggle source
# File lib/saml/elements/subject.rb, line 51
def check_identifier
  errors.add(:identifiers, :one_identifier_mandatory) if identifiers.blank?
  errors.add(:identifiers, :one_identifier_allowed)   if identifiers.size > 1
end
identifiers() click to toggle source
# File lib/saml/elements/subject.rb, line 56
def identifiers
  [_name_id, encrypted_id].compact
end