Class: Devise::Strategies::SamlAuthenticatable

Inherits:
Authenticatable
  • Object
show all
Includes:
DeviseSamlAuthenticatable::SamlConfig
Defined in:
lib/devise_saml_authenticatable/strategy.rb

Instance Method Summary collapse

Methods included from DeviseSamlAuthenticatable::SamlConfig

#saml_config

Instance Method Details

#authenticate! ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/devise_saml_authenticatable/strategy.rb', line 15

def authenticate!
  @response = OneLogin::RubySaml::Response.new(params[:SAMLResponse], settings: saml_config(get_idp_entity_id(params)))
  resource = mapping.to.authenticate_with_saml(@response)
  if @response.is_valid? && resource
    resource.after_saml_authentication(@response.sessionindex)
    success!(resource)
  else
    fail!(:invalid)
    Devise.saml_failed_callback.new.handle(@response, self) if Devise.saml_failed_callback
  end
end

#store? ⇒ Boolean

This method should turn off storage whenever CSRF cannot be verified. Any known way on how to let the IdP send the CSRF token along with the SAMLResponse ? Please let me know!

Returns:

  • (Boolean)


30
31
32
# File 'lib/devise_saml_authenticatable/strategy.rb', line 30

def store?
  true
end

#valid? ⇒ Boolean

Returns:

  • (Boolean)


7
8
9
10
11
12
13
# File 'lib/devise_saml_authenticatable/strategy.rb', line 7

def valid?
  if params[:SAMLResponse]
    OneLogin::RubySaml::Response.new(params[:SAMLResponse])
  else
    false
  end
end