Sha256: 302fc9fd1853f5ad99db02adfa2c0b15a56fb4dd1f583f18d2f65e0f90eb0e55

Contents?: true

Size: 937 Bytes

Versions: 1

Compression:

Stored size: 937 Bytes

Contents

require 'devise/strategies/authenticatable' 
module Devise
  module Strategies
    class SamlAuthenticatable < Authenticatable
      include DeviseSamlAuthenticatable::SamlConfig
      def valid?
        params[:SAMLResponse]
      end
      def authenticate!
        @response = Onelogin::Saml::Response.new(params[:SAMLResponse])
	      @response.settings = get_saml_config
	      resource = mapping.to.authenticate_with_saml(@response.attributes)
        if @response.is_valid?
          success!(resource)
        else
          fail!(:invalid)
        end
      end
      
      # 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!
      def store?
        true
      end
            
    end
  end
end

Warden::Strategies.add(:saml_authenticatable, Devise::Strategies::SamlAuthenticatable)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
devise_saml_authenticatable-0.0.1 lib/devise_saml_authenticatable/strategy.rb