Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/adamluzsi/faraday_middleware-escher
escher sign and validation for faraday http rest client
https://github.com/adamluzsi/faraday_middleware-escher
escher escher-sign escherauth faradaymiddleware
Last synced: 7 days ago
JSON representation
escher sign and validation for faraday http rest client
- Host: GitHub
- URL: https://github.com/adamluzsi/faraday_middleware-escher
- Owner: adamluzsi
- License: mit
- Created: 2015-05-29T07:04:51.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-03-01T16:13:01.000Z (over 8 years ago)
- Last Synced: 2024-10-18T18:20:20.307Z (18 days ago)
- Topics: escher, escher-sign, escherauth, faradaymiddleware
- Language: Ruby
- Size: 24.4 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# FaradayMiddleware for Escher secure authorization
escher sign and validation for faraday http rest client
## Installation
Add this line to your application's Gemfile:
gem 'faraday_middleware-escher'
And then execute:
$ bundle
Or install it yourself as:
$ gem install faraday_middleware-escher
## Usage
### for sign requests
The FaradayMiddleware::Escher::RequestSigner will help you sign your requests before sending them
```ruby
require 'faraday_middleware/escher'conn = Faraday.new do |builder|
builder.use FaradayMiddleware::Escher::RequestSigner,
credential_scope: CredentialScope,
options: AuthOptions,
active_key: -> { Escher::Keypool.new.get_active_key('EscherExample') }builder.adapter :net_http
end
```
### Response Validator
The FaradayMiddleware::Escher::ResponseValidator will help you authenticate responses on receiving
```ruby
require 'faraday_middleware/escher'conn = Faraday.new do |builder|
builder.use FaradayMiddleware::Escher::ResponseValidator,
credential_scope: CredentialScope,
options: AuthOptions,
keydb_constructor: -> { Escher::Keypool.new.get_key_db }builder.adapter :net_http
end
```
### You can mix the two in one case
Who loves Man in the Middle?
If you not, this is your setup!```ruby
require 'faraday_middleware/escher'
conn = Faraday.new do |builder|
builder.use FaradayMiddleware::Escher::RequestSigner,
credential_scope: CredentialScope,
options: AuthOptions,
active_key: -> { Escher::Keypool.new.get_active_key('EscherExample') }builder.use FaradayMiddleware::Escher::ResponseValidator,
credential_scope: CredentialScope,
options: AuthOptions,
keydb_constructor: -> { Escher::Keypool.new.get_key_db }builder.adapter :net_http
end
```
## Contributing
1. Fork it ( https://github.com/[my-github-username]/faraday_middleware-escher/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