soar_authentication_token 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 3cbc96c1ee8c188201345c363af477c5c885a4e7
4
+ data.tar.gz: 5a718b299f018d0fac5776c4cb60fbe2fa55e23f
5
+ SHA512:
6
+ metadata.gz: 65eb924547cc77a57909cdab9cb9d2305b8f4f28cfeaad13d01077f30ce2f6aa4511fee72ec0b5dc49709545693f36505db700534edbd7cf429b6cce3b2a88b7
7
+ data.tar.gz: ee4cce2df468e709959a2520460ce7c3bc63d915d3cf557d3afe3e95bb88f6b192defe62055ef20f33ca1a36e70f7200bf31894d20d811bac21f1923a722385b
data/.gitignore ADDED
@@ -0,0 +1,3 @@
1
+ Gemfile.lock
2
+ *.gem
3
+ .byebug_history
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.ruby-gemset ADDED
@@ -0,0 +1 @@
1
+ soar_authentication_token
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ ruby-2.3.0
data/Dockerfile ADDED
@@ -0,0 +1,10 @@
1
+ FROM ruby:2.3.0
2
+
3
+ WORKDIR /usr/local/src/
4
+
5
+ ADD . /usr/local/src/
6
+ RUN cd /usr/local/src/
7
+ RUN gem install bundler
8
+ RUN bundle install
9
+
10
+ CMD bundle exec rspec -cfd spec/*
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ # A sample Gemfile
2
+ source "https://rubygems.org"
3
+
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Barney de Villiers
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,49 @@
1
+ # SoarAuditingProvider
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/soar_authentication_token.png)](https://badge.fury.io/rb/soar_authentication_token)
4
+
5
+ This gem provides authentication token generation and validation capability for the SOAR architecture.
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'soar_authentication_token'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install soar_authentication_token
22
+
23
+
24
+ ## Testing
25
+
26
+ Run the rspec test tests:
27
+
28
+ $ docker-compose run --rm soar-authentication-token bundle exec rspec -cfd spec
29
+
30
+
31
+ ## Usage
32
+
33
+
34
+
35
+ ## Detailed example
36
+
37
+
38
+
39
+ ## Contributing
40
+
41
+ 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)
42
+
43
+ ## Notes
44
+
45
+
46
+
47
+ ## License
48
+
49
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ task :default => :spec
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "soar_authentication_token"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
@@ -0,0 +1,24 @@
1
+ #!/usr/bin/env ruby
2
+ require "pathname"
3
+ bin_file = Pathname.new(__FILE__).realpath
4
+ $:.unshift File.expand_path("../../lib", bin_file)
5
+
6
+ require 'soar_authentication_token'
7
+ require 'yaml'
8
+
9
+ class Main
10
+
11
+ def generate_keypair
12
+ #create and configure auditing instance
13
+ keypair_generator = SoarAuthenticationToken::KeypairGenerator.new
14
+ private_key, public_key = keypair_generator.generate
15
+ configuration = {
16
+ 'private_key' => private_key,
17
+ 'public_key' => public_key
18
+ }
19
+ print configuration.to_yaml
20
+ end
21
+ end
22
+
23
+ main = Main.new
24
+ main.generate_keypair
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,7 @@
1
+ version: '2.0'
2
+ services:
3
+ soar-authentication-token:
4
+ build: .
5
+ image: soar-authentication-token
6
+ volumes:
7
+ - .:/usr/local/src/
@@ -0,0 +1,19 @@
1
+ require 'openssl'
2
+
3
+ module SoarAuthenticationToken
4
+ class KeypairGenerator
5
+ def initialize
6
+ end
7
+
8
+ def generate
9
+ private_key = OpenSSL::PKey::EC.new 'secp521r1'
10
+ private_key.generate_key
11
+ public_key = OpenSSL::PKey::EC.new private_key
12
+ public_key.private_key = nil
13
+ [private_key.to_pem, public_key.to_pem]
14
+ end
15
+
16
+ private
17
+
18
+ end
19
+ end
@@ -0,0 +1,42 @@
1
+ require 'soar_xt'
2
+ require 'jwt'
3
+
4
+ module SoarAuthenticationToken
5
+ class TokenGenerator
6
+ DEFAULT_CONFIGURATION = {
7
+ :mode => 'local',
8
+ :private_key => '',
9
+ :url => ''
10
+ } unless defined? DEFAULT_CONFIGURATION; DEFAULT_CONFIGURATION.freeze
11
+
12
+ def initialize(configuration)
13
+ @configuration = merge_with_default_configuration(configuration)
14
+ validate_configuration
15
+ @private_key = OpenSSL::PKey::EC.new(@configuration[:private_key])
16
+ end
17
+
18
+ def generate(authenticated_identifier:)
19
+ encode(payload(authenticated_identifier))
20
+ end
21
+
22
+ private
23
+
24
+ def payload(authenticated_identifier)
25
+ { 'authenticated_identifier' => authenticated_identifier,
26
+ 'issue_time' => Time.now.utc.iso8601(3),
27
+ 'nounce' => SecureRandom.hex(32)
28
+ }
29
+ end
30
+
31
+ def encode(payload)
32
+ JWT.encode(payload, @private_key, 'ES512')
33
+ end
34
+
35
+ def validate_configuration
36
+ end
37
+
38
+ def merge_with_default_configuration(configuration)
39
+ Hash.deep_merge(DEFAULT_CONFIGURATION,configuration)
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,54 @@
1
+ require 'soar_xt'
2
+ require 'jwt'
3
+
4
+ module SoarAuthenticationToken
5
+ class TokenValidator
6
+ DEFAULT_CONFIGURATION = {
7
+ :mode => 'local',
8
+ :public_key => '',
9
+ :url => ''
10
+ } unless defined? DEFAULT_CONFIGURATION; DEFAULT_CONFIGURATION.freeze
11
+
12
+ def initialize(configuration)
13
+ @configuration = merge_with_default_configuration(configuration)
14
+ validate_configuration
15
+ @public_key = OpenSSL::PKey::EC.new(@configuration[:public_key])
16
+ @public_key.private_key = nil
17
+ end
18
+
19
+ def validate(authentication_token)
20
+ return validate_locally(authentication_token) if 'local' == @configuration[:mode]
21
+ return validate_remotely(authentication_token)
22
+ end
23
+
24
+ private
25
+
26
+ def validate_locally(authentication_token)
27
+ decoded_token_payload = decode(authentication_token)
28
+ return [false, nil] if expired?(decoded_token_payload[0]['issue_time'])
29
+ [true, decoded_token_payload[0]['authenticated_identifier']]
30
+ rescue JWT::VerificationError, JWT::DecodeError
31
+ [false, nil]
32
+ end
33
+
34
+ def validate_remotely(authentication_token)
35
+ [true, 'uuid']
36
+ end
37
+
38
+ def validate_configuration
39
+
40
+ end
41
+
42
+ def merge_with_default_configuration(configuration)
43
+ Hash.deep_merge(DEFAULT_CONFIGURATION,configuration)
44
+ end
45
+
46
+ def decode(authentication_token)
47
+ JWT.decode(authentication_token, @public_key, true, { :algorithm => 'ES512' })
48
+ end
49
+
50
+ def expired?(issue_time)
51
+ (Time.parse(issue_time) + 604800) < Time.now #TODO make this configurable
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,3 @@
1
+ module SoarAuthenticationToken
2
+ VERSION = '0.0.1'
3
+ end
@@ -0,0 +1,7 @@
1
+ module SoarAuthenticationToken
2
+ end
3
+
4
+ require 'soar_authentication_token/keypair_generator'
5
+ require 'soar_authentication_token/token_generator'
6
+ require 'soar_authentication_token/token_validator'
7
+ require 'soar_authentication_token/version'
data/sanity/.gitignore ADDED
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ .byebug_history
11
+ *.gem
@@ -0,0 +1 @@
1
+ sanity
@@ -0,0 +1 @@
1
+ ruby-2.3.0
data/sanity/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'soar_authentication_token', :path => "../"
data/sanity/sanity.rb ADDED
@@ -0,0 +1,55 @@
1
+ require 'soar_authentication_token'
2
+ require 'yaml'
3
+
4
+ class Main
5
+
6
+ def generate_keypair
7
+ #create and configure auditing instance
8
+ keypair_generator = SoarAuthenticationToken::KeypairGenerator.new
9
+ private_key, public_key = keypair_generator.generate
10
+ configuration = {
11
+ 'private_key' => private_key,
12
+ 'public_key' => public_key
13
+ }
14
+ print configuration.to_yaml
15
+ end
16
+
17
+ def round_trip_simple_code
18
+ $stderr.puts "Generating Keypair..."
19
+ $ecdsa_key = OpenSSL::PKey::EC.new 'secp521r1'
20
+ $ecdsa_key.generate_key
21
+ $ecdsa_public = OpenSSL::PKey::EC.new $ecdsa_key
22
+ $ecdsa_public.private_key = nil
23
+ $stderr.puts "Generation Complete"
24
+
25
+ $stderr.puts 'DIRECT'
26
+ json_stuff = { 'stuff' => 'bla' }
27
+ token = encode(json_stuff)
28
+ result = decode(token)
29
+ $stderr.puts result
30
+
31
+ extracted_private_key = $ecdsa_key.to_pem
32
+ extracted_public_key = $ecdsa_public.to_pem
33
+ $ecdsa_key = nil
34
+ $ecdsa_public = nil
35
+
36
+ $stderr.puts 'INDIRECT'
37
+ $ecdsa_key = OpenSSL::PKey::EC.new extracted_private_key
38
+ $ecdsa_public = OpenSSL::PKey::EC.new ''#extracted_public_key
39
+ token = encode(json_stuff)
40
+ result = decode(token)
41
+ $stderr.puts result
42
+ end
43
+
44
+ def encode(payload)
45
+ JWT.encode(payload, $ecdsa_key, 'ES512')
46
+ end
47
+
48
+ def decode(authentication_token)
49
+ JWT.decode(authentication_token, $ecdsa_public, true, { :algorithm => 'ES512' })
50
+ end
51
+ end
52
+
53
+ main = Main.new
54
+ main.generate_keypair
55
+ main.round_trip_simple_code
@@ -0,0 +1,83 @@
1
+ require 'soar_auditing_provider'
2
+ require 'log4r_auditor'
3
+ require 'soar_flow'
4
+ require 'benchmark'
5
+ require 'byebug'
6
+
7
+ class Main
8
+
9
+ AUDITING_CONFIGURATION = {
10
+ 'auditing' => {
11
+ 'level' => 'debug',
12
+ 'install_exit_handler' => 'false',
13
+ 'add_caller_source_location' => 'false',
14
+ 'queue_worker' => {
15
+ 'queue_size' => 1000000,
16
+ 'initial_back_off_in_seconds' => 1,
17
+ 'back_off_multiplier' => 2,
18
+ 'back_off_attempts' => 5
19
+ },
20
+ 'default_nfrs' => {
21
+ 'accessibility' => 'local',
22
+ 'privacy' => 'not encrypted',
23
+ 'reliability' => 'instance',
24
+ 'performance' => 'high'
25
+ },
26
+ 'auditors' => {
27
+ 'log4r' => {
28
+ 'adaptor' => 'Log4rAuditor::Log4rAuditor',
29
+ 'file_name' => 'soar_sc.log',
30
+ 'standard_stream' => 'none',
31
+ 'nfrs' => {
32
+ 'accessibility' => 'local',
33
+ 'privacy' => 'not encrypted',
34
+ 'reliability' => 'instance',
35
+ 'performance' => 'high'
36
+ }
37
+ }
38
+ }
39
+ }
40
+ }
41
+
42
+ def test_sanity
43
+ iterations = 1000000
44
+
45
+ #create and configure auditing instance
46
+ myauditing = SoarAuditingProvider::AuditingProvider.new( AUDITING_CONFIGURATION['auditing'] )
47
+ myauditing.startup_flow_id = SoarFlow::ID::generate_flow_id
48
+ myauditing.service_identifier = 'my-test-service.com'
49
+
50
+ #associate a set of auditing entries with a flow by generating a flow identifiers
51
+ flow_id = SoarFlow::ID::generate_flow_id
52
+
53
+ Benchmark.bm do |x|
54
+ myauditing = SoarAuditingProvider::AuditingProvider.new( AUDITING_CONFIGURATION['auditing'].dup.merge("level" => "warn") )
55
+ myauditing.startup_flow_id = SoarFlow::ID::generate_flow_id
56
+ myauditing.service_identifier = 'my-test-service.com'
57
+ x.report ("audit_call_below_audit_threshold:") {
58
+ iterations.times {
59
+ myauditing.info("Benchmarking test",flow_id)
60
+ }
61
+ }
62
+ myauditing = SoarAuditingProvider::AuditingProvider.new( AUDITING_CONFIGURATION['auditing'].dup.merge("add_caller_source_location" => "false") )
63
+ myauditing.startup_flow_id = SoarFlow::ID::generate_flow_id
64
+ myauditing.service_identifier = 'my-test-service.com'
65
+ x.report ("audit_call_without_caller_info :") {
66
+ iterations.times {
67
+ myauditing.info("Benchmarking test",flow_id)
68
+ }
69
+ }
70
+ myauditing = SoarAuditingProvider::AuditingProvider.new( AUDITING_CONFIGURATION['auditing'].dup.merge("add_caller_source_location" => "true") )
71
+ myauditing.startup_flow_id = SoarFlow::ID::generate_flow_id
72
+ myauditing.service_identifier = 'my-test-service.com'
73
+ x.report ("audit_call_with_caller_info :") {
74
+ iterations.times {
75
+ myauditing.info("Benchmarking test",flow_id)
76
+ }
77
+ }
78
+ end
79
+ end
80
+ end
81
+
82
+ main = Main.new
83
+ main.test_sanity
@@ -0,0 +1,29 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'soar_authentication_token/version'
5
+
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = "soar_authentication_token"
9
+ spec.version = SoarAuthenticationToken::VERSION
10
+ spec.authors = ["Barney de Villiers"]
11
+ spec.email = ["barney.de.villiers@hetzner.co.za"]
12
+ spec.description = %q{Interface to the authentication token service}
13
+ spec.summary = %q{Client library for Hetzner's authentication token service}
14
+ spec.homepage = "https://gitlab.host-h.net/hetznerZA/authentication-token-service"
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files`.split($/)
18
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
+ spec.require_paths = ["lib"]
21
+
22
+ spec.add_dependency 'soar_xt', '~> 0.0.3'
23
+ spec.add_dependency 'jwt', '~> 1.5', '>= 1.5.6'
24
+
25
+ spec.add_development_dependency 'pry', '~> 0'
26
+ spec.add_development_dependency "bundler", "~> 1.3"
27
+ spec.add_development_dependency "rake", "~> 10.0"
28
+ spec.add_development_dependency "rspec", "~> 2.13"
29
+ end
@@ -0,0 +1,24 @@
1
+ require 'spec_helper'
2
+
3
+ describe SoarAuthenticationToken::KeypairGenerator do
4
+ before :each do
5
+ @iut = SoarAuthenticationToken::KeypairGenerator.new
6
+ end
7
+
8
+ after :each do
9
+ end
10
+
11
+ it 'has a version number' do
12
+ expect(SoarAuthenticationToken::VERSION).not_to be nil
13
+ end
14
+
15
+ context "when generating a new keypair" do
16
+ it 'should provide the eliptic curve public and private key in pem format' do
17
+ private_key, public_key = @iut.generate
18
+ expect(private_key).to include('-----BEGIN EC PRIVATE KEY-----')
19
+ expect(private_key).to include('-----END EC PRIVATE KEY-----')
20
+ expect(public_key).to include('-----BEGIN PUBLIC KEY-----')
21
+ expect(public_key).to include('-----END PUBLIC KEY-----')
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,5 @@
1
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
+ $LOAD_PATH.unshift File.expand_path('../../spec/support', __FILE__)
3
+
4
+ require 'soar_authentication_token'
5
+ require 'pry'
@@ -0,0 +1,52 @@
1
+ require 'spec_helper'
2
+
3
+ describe SoarAuthenticationToken::TokenGenerator do
4
+ before :all do
5
+ keypair_generator = SoarAuthenticationToken::KeypairGenerator.new
6
+ @private_key, @public_key = keypair_generator.generate
7
+ end
8
+
9
+ before :each do
10
+ generator_configuration = {
11
+ :mode => 'local',
12
+ :private_key => @private_key
13
+ }
14
+ validator_configuration = {
15
+ :mode => 'local',
16
+ :public_key => @public_key
17
+ }
18
+ @iut = SoarAuthenticationToken::TokenGenerator.new(generator_configuration)
19
+ @validator = SoarAuthenticationToken::TokenValidator.new(validator_configuration)
20
+ end
21
+
22
+ after :each do
23
+ end
24
+
25
+ it 'has a version number' do
26
+ expect(SoarAuthenticationToken::VERSION).not_to be nil
27
+ end
28
+
29
+ context "when generating a new token locally" do
30
+ it 'should provide token using configured private key' do
31
+
32
+ #binding.pry
33
+ token = @iut.generate(authenticated_identifier: 'a@b.co.za')
34
+ print @validator.validate(token)
35
+ print @validator.validate("asdfasdf")
36
+ end
37
+ end
38
+
39
+ context "when generating a new token locally" do
40
+ it 'should provide token using the configured private key' do
41
+ #TODO
42
+ #expect(true).to eq false
43
+ end
44
+ end
45
+
46
+ context "when generating a new token remotely" do
47
+ it 'should provide token using the configured remote service' do
48
+ #TODO
49
+ #expect(true).to eq false
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,76 @@
1
+ require 'spec_helper'
2
+ require 'yaml'
3
+
4
+ describe SoarAuthenticationToken::TokenValidator do
5
+ before :all do
6
+ keypair_generator = SoarAuthenticationToken::KeypairGenerator.new
7
+ @valid_private_key, @valid_public_key = keypair_generator.generate
8
+ @invalid_private_key, @invalid_public_key = keypair_generator.generate
9
+ @test_identifier = 'a@b.co.za'
10
+ @valid_generator_configuration = {
11
+ :mode => 'local',
12
+ :private_key => @valid_private_key
13
+ }
14
+ @invalid_generator_configuration = {
15
+ :mode => 'local',
16
+ :private_key => @invalid_private_key
17
+ }
18
+ @validator_configuration = {
19
+ :mode => 'local',
20
+ :public_key => @valid_public_key
21
+ }
22
+ @valid_generator = SoarAuthenticationToken::TokenGenerator.new(@valid_generator_configuration)
23
+ @invalid_generator = SoarAuthenticationToken::TokenGenerator.new(@invalid_generator_configuration)
24
+ end
25
+
26
+ before :each do
27
+ @iut = SoarAuthenticationToken::TokenValidator.new(@validator_configuration)
28
+ end
29
+
30
+ after :each do
31
+ end
32
+
33
+ it 'has a version number' do
34
+ expect(SoarAuthenticationToken::VERSION).not_to be nil
35
+ end
36
+
37
+ context "when validating a token locally using the configured public key" do
38
+ it 'should indicate valid if the token is valid' do
39
+ token = @valid_generator.generate(authenticated_identifier: @test_identifier)
40
+ token_validity, token_identifier = @iut.validate(token)
41
+ expect(token_validity).to eq true
42
+ end
43
+
44
+ it 'should indicate invalid if the token is invalid' do
45
+ token = @invalid_generator.generate(authenticated_identifier: @test_identifier)
46
+ token_validity, token_identifier = @iut.validate(token)
47
+ expect(token_validity).to eq false
48
+ end
49
+
50
+ it 'should provide the authenticated_identifier if the token is valid' do
51
+ token = @valid_generator.generate(authenticated_identifier: @test_identifier)
52
+ token_validity, token_identifier = @iut.validate(token)
53
+ expect(token_identifier).to eq @test_identifier
54
+ end
55
+
56
+ it 'should not provide the authenticated_identifier if the token is invalid' do
57
+ token = @invalid_generator.generate(authenticated_identifier: @test_identifier)
58
+ token_validity, token_identifier = @iut.validate(token)
59
+ expect(token_identifier).to eq nil
60
+ end
61
+
62
+ it 'should indicate as invalid tokens that are older than the configured expiry time' do
63
+ #TODO
64
+ #expect(true).to eq false
65
+ end
66
+
67
+ it 'should indicate as valid tokens that are not older than the configured expiry time' do
68
+ #TODO
69
+ #expect(true).to eq false
70
+ end
71
+ end
72
+
73
+ context "when validating a token remotely using the configured url" do
74
+ #TODO
75
+ end
76
+ end
metadata ADDED
@@ -0,0 +1,170 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: soar_authentication_token
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Barney de Villiers
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-11-28 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: soar_xt
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 0.0.3
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 0.0.3
27
+ - !ruby/object:Gem::Dependency
28
+ name: jwt
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.5'
34
+ - - ">="
35
+ - !ruby/object:Gem::Version
36
+ version: 1.5.6
37
+ type: :runtime
38
+ prerelease: false
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - "~>"
42
+ - !ruby/object:Gem::Version
43
+ version: '1.5'
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: 1.5.6
47
+ - !ruby/object:Gem::Dependency
48
+ name: pry
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ - !ruby/object:Gem::Dependency
62
+ name: bundler
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: '1.3'
68
+ type: :development
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - "~>"
73
+ - !ruby/object:Gem::Version
74
+ version: '1.3'
75
+ - !ruby/object:Gem::Dependency
76
+ name: rake
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - "~>"
80
+ - !ruby/object:Gem::Version
81
+ version: '10.0'
82
+ type: :development
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - "~>"
87
+ - !ruby/object:Gem::Version
88
+ version: '10.0'
89
+ - !ruby/object:Gem::Dependency
90
+ name: rspec
91
+ requirement: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - "~>"
94
+ - !ruby/object:Gem::Version
95
+ version: '2.13'
96
+ type: :development
97
+ prerelease: false
98
+ version_requirements: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - "~>"
101
+ - !ruby/object:Gem::Version
102
+ version: '2.13'
103
+ description: Interface to the authentication token service
104
+ email:
105
+ - barney.de.villiers@hetzner.co.za
106
+ executables:
107
+ - console
108
+ - keypair-generator
109
+ - setup
110
+ extensions: []
111
+ extra_rdoc_files: []
112
+ files:
113
+ - ".gitignore"
114
+ - ".rspec"
115
+ - ".ruby-gemset"
116
+ - ".ruby-version"
117
+ - Dockerfile
118
+ - Gemfile
119
+ - LICENSE.txt
120
+ - README.md
121
+ - Rakefile
122
+ - bin/console
123
+ - bin/keypair-generator
124
+ - bin/setup
125
+ - docker-compose.yml
126
+ - lib/soar_authentication_token.rb
127
+ - lib/soar_authentication_token/keypair_generator.rb
128
+ - lib/soar_authentication_token/token_generator.rb
129
+ - lib/soar_authentication_token/token_validator.rb
130
+ - lib/soar_authentication_token/version.rb
131
+ - sanity/.gitignore
132
+ - sanity/.ruby-gemset
133
+ - sanity/.ruby-version
134
+ - sanity/Gemfile
135
+ - sanity/sanity.rb
136
+ - sanity/sanity_benchmark.rb
137
+ - soar_authentication_token.gemspec
138
+ - spec/keypair_generator_spec.rb
139
+ - spec/spec_helper.rb
140
+ - spec/token_generator_spec.rb
141
+ - spec/token_validator_spec.rb
142
+ homepage: https://gitlab.host-h.net/hetznerZA/authentication-token-service
143
+ licenses:
144
+ - MIT
145
+ metadata: {}
146
+ post_install_message:
147
+ rdoc_options: []
148
+ require_paths:
149
+ - lib
150
+ required_ruby_version: !ruby/object:Gem::Requirement
151
+ requirements:
152
+ - - ">="
153
+ - !ruby/object:Gem::Version
154
+ version: '0'
155
+ required_rubygems_version: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ requirements: []
161
+ rubyforge_project:
162
+ rubygems_version: 2.5.1
163
+ signing_key:
164
+ specification_version: 4
165
+ summary: Client library for Hetzner's authentication token service
166
+ test_files:
167
+ - spec/keypair_generator_spec.rb
168
+ - spec/spec_helper.rb
169
+ - spec/token_generator_spec.rb
170
+ - spec/token_validator_spec.rb