Module: Sinatra::GoogleAuth
- Defined in:
- lib/sinatra/google-auth.rb,
lib/sinatra/google-auth/version.rb
Defined Under Namespace
Modules: Helpers
Classes: Middleware
Constant Summary
collapse
- VERSION =
'1.3.0'
Class Method Summary
collapse
Class Method Details
.registered(app) ⇒ Object
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
# File 'lib/sinatra/google-auth.rb', line 52
def self.registered(app)
raise "Must supply ENV var GOOGLE_AUTH_DOMAIN" unless ENV['GOOGLE_AUTH_DOMAIN']
app.helpers GoogleAuth::Helpers
app.use ::Rack::Session::Cookie, :secret => secret
app.use OmniAuth::Strategies::GoogleApps, :domain => ENV['GOOGLE_AUTH_DOMAIN'], :store => nil
app.set :absolute_redirect, false
app.get "/auth/:provider/callback" do
handle_authentication_callback
end
app.post "/auth/:provider/callback" do
handle_authentication_callback
end
end
|
.secret ⇒ Object
48
49
50
|
# File 'lib/sinatra/google-auth.rb', line 48
def self.secret
ENV['SESSION_SECRET'] || ENV['SECURE_KEY'] || SecureRandom.hex(64)
end
|