Class: SpRailsSaml::SamlResponse

Inherits:
Object
  • Object
show all
Includes:
ActionDispatch::Routing, ActionView::Helpers
Defined in:
lib/sp-rails-saml/saml_response.rb

Overview

SAML2 Authentication Response.

Instance Method Summary collapse

Constructor Details

#initialize(saml_response, saml_setting) ⇒ SamlResponse

Returns a new instance of SamlResponse.



13
14
15
16
# File 'lib/sp-rails-saml/saml_response.rb', line 13

def initialize(saml_response, saml_setting)
  @saml_setting = saml_setting
  @saml_response = saml_response
end

Instance Method Details

#errorsObject



42
43
44
# File 'lib/sp-rails-saml/saml_response.rb', line 42

def errors
  response.errors
end

#name_idObject



34
35
36
# File 'lib/sp-rails-saml/saml_response.rb', line 34

def name_id
  response.name_id
end

#name_id_formatObject



38
39
40
# File 'lib/sp-rails-saml/saml_response.rb', line 38

def name_id_format
  response.name_id_format
end

#responseObject



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/sp-rails-saml/saml_response.rb', line 18

def response
  return @response if @response.present?

  @response = OneLogin::RubySaml::Response.new(
    @saml_response,
    settings: ruby_saml_settings,
    skip_subject_confirmation: SpRailsSaml::Settings::RUBY_SAML_DEFAULT_SETTINGS[:skip_subject_confirmation],
    skip_conditions: SpRailsSaml::Settings::RUBY_SAML_DEFAULT_SETTINGS[:skip_conditions],
    skip_destination: SpRailsSaml::Settings::RUBY_SAML_DEFAULT_SETTINGS[:skip_destination]
  )
end

#valid?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/sp-rails-saml/saml_response.rb', line 30

def valid?
  response.is_valid?
end