Change Base64 encoding to be url_safe, add crude implementation of a Controller

This commit is contained in:
Maciej Szlosarczyk 2018-07-20 16:46:22 +03:00
parent dc8230dcc2
commit 35c3f0a5bf
No known key found for this signature in database
GPG key ID: 41D62D42D3B0D765
6 changed files with 50 additions and 7 deletions

View file

@ -15,6 +15,7 @@ class AuthTokenCreatorTest < ActiveSupport::TestCase
def test_hashable_is_constructed_as_expected
expected_hashable = { user_ident: 'US-1234', user_username: 'Registrant User',
expires_at: '2010-07-05 00:30:00 UTC' }.to_json
assert_equal(expected_hashable, @token_creator.hashable)
end
@ -23,7 +24,7 @@ class AuthTokenCreatorTest < ActiveSupport::TestCase
encryptor.decrypt
encryptor.key = @random_bytes
base64_decoded = Base64.decode64(@token_creator.encrypted_token)
base64_decoded = Base64.urlsafe_decode64(@token_creator.encrypted_token)
result = encryptor.update(base64_decoded) + encryptor.final
hashable = { user_ident: 'US-1234', user_username: 'Registrant User',