Skip to content

quarter-spiral/auth-middleware

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Auth::Middleware

Allow any app to be protected behind a login-wall using QS ID

Usage

The middleware is a standard Rack middleware use it as such.

This makes the app only accesible when logged in:

# config.ru

require 'auth/middleware'

authed_app = Rack::Builder.new do
  use Auth::Middleware, 'my-qs-app-id', 'my-qs-app-secret', 'qs_auth_cookie_name' do |auth_tools|
    auth_tools.require_login!
  end
  run MyOriginalApp
end

run authed_app

You can also allow only admins to access your app:

# config.ru

require 'auth/middleware'

authed_app = Rack::Builder.new do
  use Auth::Middleware, 'my-qs-app-id', 'my-qs-app-secret', 'qs_auth_cookie_name' do |auth_tools|
    auth_tools.require_admin!
  end
  run MyOriginalApp
end

run authed_app

About

Allow any app to be protected behind a login-wall using QS ID

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages