Sha256: 81be34864697e5946c0caa323b0390faeaf1b646d3a58bd312a97dcf45b5514d

Contents?: true

Size: 1.96 KB

Versions: 1

Compression:

Stored size: 1.96 KB

Contents

[![Code Climate](https://codeclimate.com/github/NuffieProductions/ClaimToken.png)](https://codeclimate.com/github/NuffieProductions/ClaimToken)
<img src="https://codeclimate.com/repos/52d4a365e30ba00f2700256c/badges/e0b32fe49c4b5695cdf1/coverage.png"><br/>
<img src="https://circleci.com/gh/NuffieProductions/ClaimToken.png?circle-token=39bd4a9416dd8d9f3f7f647d63565297e2e77a11" />
# ClaimToken

ClaimToken encrypts and signs tokens to be used in a claim-based authentication system

## Installation

Add this line to your application's Gemfile:

    gem 'claim_token'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install claim_token

## Usage

    ClaimToken.configure do |config|
      config.cipher_type = "aes-256-cbc"  # this is the default
      config.shared_encryption_key = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
      config.digest_secret = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
    end

To encrypt and encode a claim token:

    token = {"your_permissions" => "I HAZ THEM", "expires" => "2014-01-14T01:26:07Z"}
    ClaimToken.pack(token)

To decode and decrypt a claim token:

    packed_token = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..."
    ClaimToken.extract(packed_token)

## Contributing

1. Fork it
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 new Pull Request

## License

Copyright 2014 CricHQ Limited

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
claim_token-0.0.1 README.md