diff --git a/doc/api/admin/token.md b/doc/api/admin/token.md index 3b68f042ffd7fc15a4b9ac0e02a8c86d582a2f73..5383be35bc8d7b96638a3c5a8d4de15a61b6e658 100644 --- a/doc/api/admin/token.md +++ b/doc/api/admin/token.md @@ -38,6 +38,7 @@ Returns information about a token. Supported tokens: - [Personal access tokens](../../user/profile/personal_access_tokens.md) +- [Impersonation tokens](../../api/rest/authentication.md#impersonation-tokens) - [Deploy tokens](../../user/project/deploy_tokens/index.md) - [Feed tokens](../../security/tokens/index.md#feed-token) - [OAuth application secrets](../../integration/oauth_provider.md) diff --git a/spec/lib/authn/agnostic_token_identifier_spec.rb b/spec/lib/authn/agnostic_token_identifier_spec.rb index 89b0d80ce7a41e4fca71784b996ed9b45e6244dd..f7f37b66eb79139ba32c191570927a42956aadb1 100644 --- a/spec/lib/authn/agnostic_token_identifier_spec.rb +++ b/spec/lib/authn/agnostic_token_identifier_spec.rb @@ -9,6 +9,7 @@ let_it_be(:deploy_token) { create(:deploy_token).token } let_it_be(:feed_token) { user.feed_token } let_it_be(:personal_access_token) { create(:personal_access_token, user: user).token } + let_it_be(:impersonation_token) { create(:personal_access_token, :impersonation, user: user).token } let_it_be(:oauth_application_secret) { create(:oauth_application).plaintext_secret } let_it_be(:cluster_agent_token) { create(:cluster_agent_token, token_encrypted: nil).token } let_it_be(:runner_authentication_token) { create(:ci_runner, registration_type: :authenticated_user).token } @@ -18,6 +19,7 @@ context 'with supported token types' do where(:plaintext, :token_type) do ref(:personal_access_token) | ::Authn::Tokens::PersonalAccessToken + ref(:impersonation_token) | ::Authn::Tokens::PersonalAccessToken ref(:feed_token) | ::Authn::Tokens::FeedToken ref(:deploy_token) | ::Authn::Tokens::DeployToken ref(:oauth_application_secret) | ::Authn::Tokens::OauthApplicationSecret diff --git a/spec/requests/api/admin/token_spec.rb b/spec/requests/api/admin/token_spec.rb index 1c9415489ef2fbec302a529954616f52029f40ec..1dfab6223d02ee7ac343bc122cb4877253f80d77 100644 --- a/spec/requests/api/admin/token_spec.rb +++ b/spec/requests/api/admin/token_spec.rb @@ -13,6 +13,7 @@ let_it_be(:oauth_application) { create(:oauth_application) } let_it_be(:cluster_agent_token) { create(:cluster_agent_token, token_encrypted: nil) } let_it_be(:runner_authentication_token) { create(:ci_runner, registration_type: :authenticated_user) } + let_it_be(:impersonation_token) { create(:personal_access_token, :impersonation, user: user) } let(:plaintext) { nil } let(:params) { { token: plaintext } } @@ -29,7 +30,8 @@ [ref(:user), lazy { user.feed_token }], [ref(:oauth_application), lazy { oauth_application.plaintext_secret }], [ref(:cluster_agent_token), lazy { cluster_agent_token.token }], - [ref(:runner_authentication_token), lazy { runner_authentication_token.token }] + [ref(:runner_authentication_token), lazy { runner_authentication_token.token }], + [ref(:impersonation_token), lazy { impersonation_token.token }] ] end