Rack::Ip::Authorizer
Basic Rack middleware for Rails 3 to authorize access to path by IP
Installation
Add this line to your application's Gemfile:
gem 'rack-ip-authorizer'
And then execute:
$ bundle
Or install it yourself as:
$ gem install rack-ip-
Usage
Rails 3 apps
- Create a file named "ip_authorizations.yml" in config directory
- Fill it with paths (keys) and IPs (values) see example below
admin:
- 192.168.0.1
- 192.168.0.2
- 192.168.0.3
superadmin:
- 192.168.0.1
- 192.168.0.2
Environment filter
Create an initializer and add:
Rack::IpAuthorizer.env_to_check = ['staging','development']
Based on the file names in 'config/environments' you can use any of them including Rails defaults.
Contributing
- Fork it
- Create your feature branch
- Commit your changes
- Push to the branch
- Create new Pull Request