Class: Saml::Elements::Subject

Inherits:
Object
  • Object
show all
Includes:
Base
Defined in:
lib/saml/elements/subject.rb

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Subject

Returns a new instance of Subject.



18
19
20
21
22
23
24
25
26
27
# 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

Instance Method Details

#name_idObject



29
30
31
# File 'lib/saml/elements/subject.rb', line 29

def name_id
  @_name_id.try(:value)
end

#name_id=(value) ⇒ Object



33
34
35
# File 'lib/saml/elements/subject.rb', line 33

def name_id=(value)
  @_name_id.value = value if @_name_id
end

#name_id_formatObject



37
38
39
# File 'lib/saml/elements/subject.rb', line 37

def name_id_format
  @_name_id.try(:format)
end

#subject_confirmationObject



41
42
43
# File 'lib/saml/elements/subject.rb', line 41

def subject_confirmation
  subject_confirmations.first
end

#subject_confirmation=(subject_confirmation) ⇒ Object



45
46
47
# File 'lib/saml/elements/subject.rb', line 45

def subject_confirmation=(subject_confirmation)
  self.subject_confirmations = [subject_confirmation]
end