Sha256: c50b9d8cb586b21f33b40c58de51977f9e35307a2be2f40cb907896e7b7a53f7

Contents?: true

Size: 1.36 KB

Versions: 2

Compression:

Stored size: 1.36 KB

Contents

require 'spec_helper'

describe SoarAuthenticationToken::TokenGenerator do
  before :all do
    keypair_generator = SoarAuthenticationToken::KeypairGenerator.new
    @private_key, @public_key = keypair_generator.generate
  end

  before :each do
    generator_configuration = {
      'mode' => 'local',
      'private_key' => @private_key
    }
    validator_configuration = {
      'mode' => 'local',
      'public_key' => @public_key
    }
    @iut = SoarAuthenticationToken::TokenGenerator.new(generator_configuration)
    @validator = SoarAuthenticationToken::TokenValidator.new(validator_configuration)
  end

  after :each do
  end

  it 'has a version number' do
    expect(SoarAuthenticationToken::VERSION).not_to be nil
  end

  context "when generating a new token locally" do
    it 'should provide token using configured private key' do

      #binding.pry
      token = @iut.generate(authenticated_identifier: 'a@b.co.za')
      print @validator.validate(token)
      print @validator.validate("asdfasdf")
    end
  end

  context "when generating a new token locally" do
    it 'should provide token using the configured private key' do
      #TODO
      #expect(true).to eq false
    end
  end

  context "when generating a new token remotely" do
    it 'should provide token using the configured remote service' do
      #TODO
      #expect(true).to eq false
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
soar_authentication_token-0.0.3 spec/token_generator_spec.rb
soar_authentication_token-0.0.2 spec/token_generator_spec.rb