Class: AuthProxy
- Inherits:
-
Object
- Object
- AuthProxy
- Includes:
- Validator
- Defined in:
- lib/auth_proxy.rb,
lib/auth_proxy/proxy.rb,
lib/auth_proxy/version.rb,
lib/auth_proxy/callback.rb,
lib/auth_proxy/validator.rb
Defined Under Namespace
Modules: Validator Classes: Callback, Proxy
Constant Summary collapse
- VERSION =
"0.1.1"
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(auth_options = {}, host_options = {}) ⇒ AuthProxy
constructor
A new instance of AuthProxy.
Methods included from Validator
#authenticated?, #rack_request, #valid_callback?, #valid_cookie?
Constructor Details
#initialize(auth_options = {}, host_options = {}) ⇒ AuthProxy
Returns a new instance of AuthProxy.
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/auth_proxy.rb', line 12 def initialize(={}, ={}) @auth_options = @app = Rack::Router.new do get "/auth/github/callback" => AuthProxy::Callback.new() .keys.each do |path| get path + '/*' => AuthProxy::Proxy.new() end end end |
Instance Method Details
#call(env) ⇒ Object
23 24 25 26 27 |
# File 'lib/auth_proxy.rb', line 23 def call(env) @env = env return authenticate unless authenticated? @app.call(env) end |