Sha256: 02aaf15256711bde1d8f4dc62c9d24d6317aef25cda2ea492dbfbe1ef6c586e6

Contents?: true

Size: 867 Bytes

Versions: 7

Compression:

Stored size: 867 Bytes

Contents

Janus::Manager.after_login do |user, manager, options|
  if user.respond_to?(:generate_session_token!)
    user.generate_session_token! if user.session_token.nil?

    session = manager.session(options[:scope])
    session[:session_token] = user.session_token
  end
end

Janus::Manager.after_authenticate do |user, manager, options|
  if user.respond_to?(:session_token)
    session = manager.session(options[:scope])
    session[:session_token] = user.session_token
  end
end

Janus::Manager.after_logout do |user, manager, options|
  user.destroy_session_token! if user.respond_to?(:destroy_session_token!)
end

Janus::Manager.after_fetch do |user, manager, options|
  if user.respond_to?(:session_token)
    scope   = options[:scope]
    session = manager.session(scope)
    manager.unset_user(scope) unless session[:session_token] == user.session_token
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
janus-0.10.1 lib/janus/hooks/remote_authenticatable.rb
janus-0.10.0 lib/janus/hooks/remote_authenticatable.rb
janus-0.9.1 lib/janus/hooks/remote_authenticatable.rb
janus-0.9.0 lib/janus/hooks/remote_authenticatable.rb
janus-0.8.1 lib/janus/hooks/remote_authenticatable.rb
janus-0.8.0 lib/janus/hooks/remote_authenticatable.rb
janus-0.7.0 lib/janus/hooks/remote_authenticatable.rb