Commit c04f56d3 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Add specs scaffold for encrypted token authenticatable

parent ce22c7e1
...@@ -20,7 +20,8 @@ module TokenAuthenticatableStrategies ...@@ -20,7 +20,8 @@ module TokenAuthenticatableStrategies
def get_token(instance) def get_token(instance)
raw_token = instance.read_attribute(encrypted_field) raw_token = instance.read_attribute(encrypted_field)
token = Gitlab::CryptoHelper.aes256_gcm_decrypt(raw_token) token = Gitlab::CryptoHelper.aes256_gcm_decrypt(raw_token)
token ||= fallback_strategy.get_token(instance) if fallback?
token || (fallback_strategy.get_token(instance) if fallback?)
end end
def set_token(instance, token) def set_token(instance, token)
......
require 'spec_helper'
describe TokenAuthenticatableStrategies::Encrypted do
let(:model) { double(:model) }
let(:options) { { fallback: true } }
subject do
described_class.new(model, 'some_field', options)
end
describe '#find_token_authenticatable' do
end
describe '#get_token' do
end
describe '#set_token' do
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment