class J1WardenOmniAuth::Strategy

The base omniauth warden strategy. This is inherited for each omniauth strategy

Attributes

omni_name[RW]

Public Class Methods

on_callback(&blk) click to toggle source

make a specific callback for this strategy

# File lib/j1_app/j1_auth_manager/warden_omniauth.rb, line 68
def self.on_callback(&blk)
  @on_callback = blk if blk
  @on_callback || J1WardenOmniAuth.on_callback
end

Public Instance Methods

authenticate!() click to toggle source
# File lib/j1_app/j1_auth_manager/warden_omniauth.rb, line 83
def authenticate!
  session = env[SESSION_KEY]
  session[SCOPE_KEY] = scope

  # set the user if exists otherwise redirect for authentication
  if user = (env['omniauth.auth'] || env['rack.auth'] || request['auth'])
    success! self.class.on_callback[user]
  else
    path_prefix = OmniAuth::Configuration.instance.path_prefix
    redirect! File.join(path_prefix, self.class.omni_name)
  end
end
authenticated?() click to toggle source
# File lib/j1_app/j1_auth_manager/warden_omniauth.rb, line 96
def authenticated?
  !session[:uid].nil?
end