Class: OpenSesame::GithubWarden

Inherits:
Warden::Strategies::Base
  • Object
show all
Defined in:
lib/open_sesame/github_warden.rb

Instance Method Summary collapse

Instance Method Details

#auth_hashObject



23
24
25
# File 'lib/open_sesame/github_warden.rb', line 23

def auth_hash
  request.env['omniauth.auth']
end

#authenticate!Object



11
12
13
14
15
16
17
# File 'lib/open_sesame/github_warden.rb', line 11

def authenticate!
  if member = OpenSesame::Member.find()
    success! member
  else
    fail 'Sorry, you do not have access'
  end
end

#github_loginObject



19
20
21
# File 'lib/open_sesame/github_warden.rb', line 19

def 
  auth_hash['info']['nickname']
end

#valid?Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/open_sesame/github_warden.rb', line 7

def valid?
  auth_hash && auth_hash["provider"] == "github"
end