Sha256: a074f61632afd9e7af4419350f4002dd151e60e32af9ccfb41be6a816dd69744
Contents?: true
Size: 1.22 KB
Versions: 2
Compression:
Stored size: 1.22 KB
Contents
# DecodeThis [](https://travis-ci.org/myxaluch/decode_this) [](https://codeclimate.com/github/myxaluch/decode_this) Simple decoder JWT token by given key ## Installation Add this line to your application's Gemfile: ```ruby gem 'decode_this' ``` And then execute: $ bundle Or install it yourself as: $ gem install decode_this ## Usage Configuration file scheme: ``` test: algorithm: 'RS256' authorization_scheme: 'Bearer' key_path: 'paht/to/keys' ``` In code: ```ruby payload = { 'field1' => 'foo', 'field2' => 'bar' } jwt_token = JWT.encode(payload, private_key, true, algorithm: algorithm) response.headers['Authentication'] = "Bearer #{jwt_token}" ... header_value = request.env['HTTP_AUTHENTICATION'] // "Bearer fgjsgkjsfslfjg.." decoded_token = DecodeThis::Decoder.new( header_value, config_file: '/path/to/config.yml', env: :my_env, logger: logger ).call decoded_token['field1'] = 'foo' decoded_token['field2'] = 'bar' ``` ## Contributing Bug reports and pull requests are welcome on GitHub at https://github.com/myxaluch/decode_this.
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
decode_this-0.1.7 | Readme.md |
decode_this-0.1.6 | Readme.md |