https://github.com/emartech/escher-rack_middleware-ruby
Escher::RackMiddleware for Ruby
https://github.com/emartech/escher-rack_middleware-ruby
Last synced: about 1 year ago
JSON representation
Escher::RackMiddleware for Ruby
- Host: GitHub
- URL: https://github.com/emartech/escher-rack_middleware-ruby
- Owner: emartech
- License: mit
- Created: 2015-04-03T06:19:59.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2021-08-16T09:13:48.000Z (almost 5 years ago)
- Last Synced: 2025-05-29T00:08:12.580Z (about 1 year ago)
- Language: Ruby
- Size: 22.5 KB
- Stars: 1
- Watchers: 22
- Forks: 6
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Escher::RackMiddleware
Rack Middleware for ease of use escher authentication for your application
## Installation
Add this line to your application's Gemfile:
gem 'escher-rack_middleware'
And then execute:
$ bundle
Or install it yourself as:
$ gem install escher-rack_middleware
## Usage
```ruby
require 'escher/rack_middleware'
Escher::RackMiddleware.config do |c|
# the default logger use the ruby core logger with STDOUT
c.logger= some_logger_instance
# for read more about escher auth object initialization please visit escherauth.io
c.add_escher_authenticator{ Escher::Auth.new( CredentialScope, AuthOptions ) }
# this will be triggered every time a request hit your appication
c.add_credential_updater{ Escher::Keypool.new.get_key_db }
# autorization defaults to all paths
# this help you exclude path(s) if you dont want require authorization for every endpoint
c.add_exclude_path(/^\/*monitoring\//)
# Alternatively, you can just authorize some paths:
# this help you just include certain paths for authorization
# c.add_include_path(/^\/*integrations\//)
# NOTE: You can either use excluded paths or included_paths, using both will throw an
# exception.
end
use Escher::RackMiddleware
run YourAwesomeApplication
```
## Contributing
1. Fork it ( https://github.com/[my-github-username]/escher-rack_middleware/fork )
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new Pull Request