Class: Rack::NinjaAuth::Middleware

Inherits:
Sinatra::Base
  • Object
show all
Defined in:
lib/rack/ninja_auth.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, email_matcher: //, secured_routes: //, not_allowed_file: nil) ⇒ Middleware

Returns a new instance of Middleware.



21
22
23
24
25
26
27
28
# File 'lib/rack/ninja_auth.rb', line 21

def initialize(app, email_matcher: //, secured_routes: //, not_allowed_file: nil)
  $stderr.puts "Please set NINJA_GOOGLE_CLIENT_ID and NINJA_GOOGLE_CLIENT_SECRET to use NinjaAuth" unless ENV["NINJA_GOOGLE_CLIENT_ID"] && ENV["NINJA_GOOGLE_CLIENT_SECRET"]
  @main_app = app
  @email_matcher = email_matcher
  @secured_route_matcher = secured_routes
  @not_allowed_file = not_allowed_file || ::File.expand_path('../../../views/401.html', __FILE__)
  super()
end