AuthTokenStoreProvider

Gem Version

This gem provides authentication token storage client library in order to interface with the authentication token storage service.

Installation

Add this line to your application's Gemfile:

gem 'auth_token_store_provider'

And then execute:

$ bundle

Or install it yourself as:

$ gem install authentication_token_store --source http://gems.hetzner.co.za

Testing

Locally run the tests:

$ bundle exec rspec -cfd spec/*

Usage

StubClient

  provider = AuthTokenStoreProvider::StubClient.new

Adding a token

  provider.add(token_identifier: '4603547ba5bdc6',
               authenticated_identifier: 'uuid123',
               token_issue_time: '2017-01-11T14:00:36+02:00',
               token_expiry_time: '2017-01-12T14:00:36+02:00')

Removing a token

  provider.remove(token_identifier: '4603547ba5bdc6')

Removing all tokens for a authenticated_identifier

  provider.remove_tokens_for(authenticated_identifier: 'uuid123')

Determine if a token exist

provider.token_exist?(
  token_identifier: '4603547ba5bdc6',
  authenticated_identifier: 'uuid123',
  token_issue_time:  '2017-01-11T14:00:36+02:00',
  token_expiry_time: '2017-01-12T14:00:36+02:00'
)

List all tokens for a authenticated_identifier

provider.subject.list_tokens_for(authenticated_identifier: 'uuid123')

Detailed example

Contributing

Bug reports and feature requests are welcome by email to barney dot de dot villiers at hetzner dot co dot za. This gem is sponsored by Hetzner (Pty) Ltd (http://hetzner.co.za)

Notes

License

The gem is available as open source under the terms of the MIT License.