From b8d66d7923150402f54f13d793d3051efab3a832 Mon Sep 17 00:00:00 2001 From: Taylan Develioglu Date: Mon, 6 Jul 2020 14:09:55 +0200 Subject: Add support obtaining personal access tokens via SSH Implements the feature requested in gitlab-org/gitlab#19672 This requires the internal api counterpart in gitlab-org/gitlab!36302 to be merged first. It can be used as follows: ``` censored@censored-VirtualBox:~/git/gitlab$ ssh git@gitlab-2004 personal_access_token remote: remote: ======================================================================== remote: remote: Usage: personal_access_token [ttl_days] remote: remote: ======================================================================== remote: censored@censored-VirtualBox:~/git/gitlab$ ssh git@gitlab-2004 personal_access_token newtoken read_api,read_repository 30 Token: aAY1G3YPeemECgUvxuXY Scopes: read_api,read_repository Expires: 2020-08-07 ``` --- internal/command/command_test.go | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'internal/command/command_test.go') diff --git a/internal/command/command_test.go b/internal/command/command_test.go index 2ca319e..db55e7d 100644 --- a/internal/command/command_test.go +++ b/internal/command/command_test.go @@ -11,6 +11,7 @@ import ( "gitlab.com/gitlab-org/gitlab-shell/internal/command/discover" "gitlab.com/gitlab-org/gitlab-shell/internal/command/healthcheck" "gitlab.com/gitlab-org/gitlab-shell/internal/command/lfsauthenticate" + "gitlab.com/gitlab-org/gitlab-shell/internal/command/personalaccesstoken" "gitlab.com/gitlab-org/gitlab-shell/internal/command/receivepack" "gitlab.com/gitlab-org/gitlab-shell/internal/command/shared/disallowedcommand" "gitlab.com/gitlab-org/gitlab-shell/internal/command/twofactorrecover" @@ -98,6 +99,12 @@ func TestNew(t *testing.T) { arguments: []string{"key", "principal"}, expectedType: &authorizedprincipals.Command{}, }, + { + desc: "it returns a PersonalAccessToken command", + executable: gitlabShellExec, + environment: buildEnv("personal_access_token"), + expectedType: &personalaccesstoken.Command{}, + }, } for _, tc := range testCases { -- cgit v1.2.1