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

#get_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])
  @response.settings = get_saml_config
  resource = mapping.to.authenticate_with_saml(@response)
  if @response.is_valid?
    resource.after_saml_authentication(@response.sessionindex)
    success!(resource)
  else
    fail!(:invalid)
  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)


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

def valid?
  if params[:SAMLResponse]
    response = OneLogin::RubySaml::Logoutresponse.new(params[:SAMLResponse], get_saml_config)
    !(response.response.include? 'LogoutResponse')
  else
    false
  end
end