Sha256: 57a6ae3902649e92df8ee371f05bfdf5a8fc4eea611399a6a9741752a28b21fe

Contents?: true

Size: 798 Bytes

Versions: 3

Compression:

Stored size: 798 Bytes

Contents

module Sso
  module Warden
    module Hooks
      class AfterAuthentication
        include ::Sso::Warden::Support

        def call
          debug { "Starting hook because this is considered the first login of the current session..." }
          generate_session
          return nil
        end

        def generate_session
          debug { "Generating a Sso:Session for user #{user.id.inspect} for the session cookie at the Sso server..." }
          attributes = {  ip: request.ip, agent: request.user_agent }

          sso_session = Sso::Session.generate_master(user, attributes)
          debug { "Sso:Session with ID #{sso_session.id} generated successfuly. Persisting it in session..." }
          session["sso_session_id"] = sso_session.id.to_s
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
doorkeeper_sso-0.2.7 lib/sso/warden/hooks/after_authentication.rb
doorkeeper_sso-0.2.6 lib/sso/warden/hooks/after_authentication.rb
doorkeeper_sso-0.2.5 lib/sso/warden/hooks/after_authentication.rb