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


19
20
21
22
23
24
25
26
# File 'lib/devise_saml_authenticatable/strategy.rb', line 19

def authenticate!
  parse_saml_response
  retrieve_resource unless self.halted?
  unless self.halted?
    @resource.after_saml_authentication(@response.sessionindex)
    success!(@resource)
  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)

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

def store?
  !mapping.to.skip_session_storage.include?(:saml_auth)
end

#valid?Boolean

Returns:

  • (Boolean)

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

def valid?
  if params[:SAMLResponse]
    OneLogin::RubySaml::Response.new(
      params[:SAMLResponse],
      settings: saml_config(get_idp_entity_id(params)),
      allowed_clock_drift: Devise.allowed_clock_drift_in_seconds,
    )
  else
    false
  end
end