As we reevaluate how to best support and maintain Staging Ref in the future, we encourage development teams using this environment to highlight their use cases in the following issue: https://gitlab.com/gitlab-com/gl-infra/software-delivery/framework/software-delivery-framework-issue-tracker/-/issues/36.

Skip to content
Snippets Groups Projects
Unverified Commit 504aaeac authored by Igor Drozdov's avatar Igor Drozdov
Browse files

Send ssh_certificates as protocol

When a user is authenticated via SSH certificates, let's
send a different protocol rather than simple `ssh`
parent fbe901bd
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -13,8 +13,9 @@ import (
)
const (
protocol = "ssh"
anyChanges = "_any"
sshProtocol = "ssh"
sshCertProtocol = "ssh_certificates"
anyChanges = "_any"
)
type Client struct {
Loading
Loading
@@ -87,11 +88,15 @@ func (c *Client) Verify(ctx context.Context, args *commandargs.Shell, action com
request := &Request{
Action: action,
Repo: repo,
Protocol: protocol,
Changes: anyChanges,
Protocol: sshProtocol,
NamespacePath: args.Env.NamespacePath,
}
if args.Env.NamespacePath != "" {
request.Protocol = sshCertProtocol
}
if args.GitlabUsername != "" {
request.Username = args.GitlabUsername
} else if args.GitlabKrb5Principal != "" {
Loading
Loading
Loading
Loading
@@ -266,14 +266,17 @@ func setup(t *testing.T, userResponses, keyResponses map[string]testResponse) *C
_, err := w.Write(tr.body)
require.NoError(t, err)
require.Equal(t, namespace, requestBody.NamespacePath)
require.Equal(t, sshCertProtocol, requestBody.Protocol)
} else if tr, ok := userResponses[requestBody.Krb5Principal]; ok {
w.WriteHeader(tr.status)
_, err := w.Write(tr.body)
require.NoError(t, err)
require.Equal(t, sshProtocol, requestBody.Protocol)
} else if tr, ok := keyResponses[requestBody.KeyId]; ok {
w.WriteHeader(tr.status)
_, err := w.Write(tr.body)
require.NoError(t, err)
require.Equal(t, sshProtocol, requestBody.Protocol)
}
},
},
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment