Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport - 2.8] Change Auth Token Env Var Name #9687 #9693

Merged
merged 2 commits into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/internal/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -578,11 +578,11 @@ func newOnUserMachine(ctx context.Context, cfg *config.Config, context *config.C
if err != nil {
return nil, errors.Wrapf(err, "could not connect to pachd at %q", pachdAddress.Qualified())
}
// if PACH_ID_TOKEN exists in env, try to produce a session token from it if one does not exist
if idToken := os.Getenv("PACH_ID_TOKEN"); idToken != "" && context.SessionToken == "" {
// if DEX_TOKEN exists in env, try to produce a session token from it if one does not exist
if idToken := os.Getenv("DEX_TOKEN"); idToken != "" && context.SessionToken == "" {
if r, err := client.Authenticate(ctx, &auth.AuthenticateRequest{IdToken: idToken}); err != nil {
if !auth.IsErrNotActivated(err) {
log.Error(ctx, "failed to exchange PACH_ID_TOKEN from environment for a pachyderm session token", zap.Error(err))
log.Error(ctx, "failed to exchange DEX_TOKEN from environment for a pachyderm session token", zap.Error(err))
}
} else {
context.SessionToken = r.PachToken
Expand Down
2 changes: 1 addition & 1 deletion src/server/auth/cmds/cmds_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ func TestIDTokenFromEnv(t *testing.T) {
).Run())
require.NoError(t, tu.PachctlBashCmd(t, c, `
echo "" | pachctl auth use-auth-token;
export PACH_ID_TOKEN={{.token}};
export DEX_TOKEN={{.token}};
pachctl auth whoami | match user:{{.user}}`,
"user", tu.DexMockConnectorEmail,
"token", token,
Expand Down