Commit 99c302f0 authored by Krasimir Angelov's avatar Krasimir Angelov

Rename ConanToken's #to_s to #to_jwt to be more explicit

parent bee3a686
......@@ -20,7 +20,8 @@ module API
detail 'This feature was introduced in GitLab 12.2'
end
get 'authenticate' do
::Gitlab::ConanToken.from_personal_access_token(access_token)
token = ::Gitlab::ConanToken.from_personal_access_token(access_token)
token.to_jwt
end
end
......
......@@ -31,7 +31,7 @@ module Gitlab
@user_id = user_id
end
def to_s
def to_jwt
hmac_token.encoded
end
......
......@@ -46,7 +46,7 @@ describe Gitlab::ConanToken do
end
end
describe '#to_s' do
describe '#to_jwt' do
it 'returns the encoded JWT' do
allow(SecureRandom).to receive(:uuid).and_return('u-u-i-d')
......@@ -55,7 +55,7 @@ describe Gitlab::ConanToken do
token = described_class.new(personal_access_token_id: 123, user_id: 456)
expect(token.to_s).to eq(jwt.encoded)
expect(token.to_jwt).to eq(jwt.encoded)
end
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