Repository URL to install this package:
|
Version:
0.2.1 ▾
|
| bin |
| lib |
| .gitignore |
| .rspec |
| .travis.yml |
| Gemfile |
| LICENSE.txt |
| README.md |
| Rakefile |
| as_jwt_auth.gemspec |
This gem provides a method for handling JWT authentication between AS services.
Add this line to your application's Gemfile:
# make sure gemfury source is also in this file. gem 'as_jwt_auth'
And then execute:
$ bundle
Here is an example of how AsJWTAuth is used in ActionSprout/fern and ActionSprout/waterleaf.
# Generate a JWT in fern jwt_string = AsJWTAuth.generate_jwt({ 'aud' => 'as-waterleaf' }, key: Fern.private_key) # Verify that JWT in waterleaf AsJWTAuth.verify_jwt jwt_string, key: ferns_public_key # => true or false
Currently, each service so far already knows what other service is expected to be making the call, but in the future, it may be that an endpoint is accessible by more than one service. In this case, the service will need to determine who has made the call in order to use the correct public key to verify with.
When we have that requirement, we plan to add logic and configuration to AsJWTAuth to handle finding the correct public key.
https://github.com/ActionSprout/as_jwt_auth.gitbin/setup (this runs bundle install)rake specYou can also run bin/console for an interactive prompt that will allow you to experiment.
Use locally To install this gem into a local project add to your Gemfile
gem 'as_jwt_auth', path: 'relative/path/to/gem/repo'
and then bundle install in that project. Remember to add the Gemfury source before
using in production.
Update the version number in lib/as_jwt_auth/version.rb and make you final version change commit.
Create a release tag with gem_push=no rake release.
Make sure you have the git remote fury added (can be called anything).
$ git remote add fury https://PASSWORD@repo.fury.io/ORGANIZATION/
To release the new verison we push to our Gemfury repo.
$ git push fury master