Giter Club home page Giter Club logo

escher-rack_middleware-ruby's Introduction

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

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

escher-rack_middleware-ruby's People

Contributors

adamluzsi avatar menyhertfatyol avatar thilonel avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

escher-rack_middleware-ruby's Issues

Please publish the current code version to rubygems

Since @miguelverissimo pull request got merged with master, Emarsys didn't release a new version of this gem.

As i need the include_path feature I'm requiring this code directly from the git repository as you can see in the code bellow; Bundler seems to have a bug that he doesn't respect the gem declaration order and first requires the gems fetched via local or git repositories.

Since escher-rack_middlerware requires inside its code escher (the echer-ruby gem) bundler breaks.

You can test the behaviour following this steps:

1 Create a Gemfile with the following content:

source "https://rubygems.org"

# gem "rails"
gem "escher"
gem 'escher-rack_middleware', require: 'escher/rack_middleware', 'git@github.com:emartech/escher-rack_middleware-ruby.git

2 Then create a ruby script with the following content, eg: test.rb

require 'bundler'
Bundler.require(:default)

3 Run the script

$ bundler
$ ruby test.rb

Please do a gem list and remove escher and escher-rack_middleware from your sistem using gem uninstall <gem name> if you have already them installed.

If everything goes according to planned you will probably see the following error:

here was a LoadError while loading escher-rack_middleware.gemspec:
cannot load such file -- escher from
  /servers/sites/backend-saas/shared/bundle/ruby/2.1.0/bundler/gems/escher-rack_middleware-ruby-aa2991709e5f/escher-rack_middleware.gemspec:4:in `<main>'

Does it try to require a relative path? That's been removed in Ruby 1.9.

This happens because I'm requiring escher-rack_middleware gem from a git repository, bundler ignores the declaration order inside the Gemfile and fetches first the code from the git repos and requires them first.

Knowing that, would be nice if you release a new version of the gem, with the master branch code.

NOTE: There is a way to circumvent this situation that is requiring escher ruby also as a git repository but that's not the "ruby" way and that way you have a gem inside ruby gems updated.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.