in internal/gitlabnet/accessverifier/client.go [102:129]
func (c *Client) Verify(ctx context.Context, args *commandargs.Shell, action commandargs.CommandType, repo string) (*Response, error) {
request := &Request{
Action: action,
Repo: repo,
Changes: anyChanges,
Protocol: sshProtocol,
NamespacePath: args.Env.NamespacePath,
}
switch {
case args.GitlabUsername != "":
request.Username = args.GitlabUsername
case args.GitlabKrb5Principal != "":
request.Krb5Principal = args.GitlabKrb5Principal
default:
request.KeyID = args.GitlabKeyID
}
request.CheckIP = gitlabnet.ParseIP(args.Env.RemoteAddr)
response, err := c.client.Post(ctx, "/allowed", request)
if err != nil {
return nil, err
}
defer func() { _ = response.Body.Close() }()
return parse(response, args)
}