src/plugin/vault/pachyderm/login.go
func generateUserCredentials(ctx context.Context, pachdAddress string, adminToken string, username string, ttl time.Duration) (string, error) {
	// Setup a single use client w the given admin token / address
	client, err := pclient.NewFromAddress(pachdAddress)
	if err != nil {
		return "", err
	}
	defer client.Close() // avoid leaking connections

	client = client.WithCtx(ctx)
	client.SetAuthToken(adminToken)

	resp, err := client.AuthAPIClient.GetAuthToken(client.Ctx(), &auth.GetAuthTokenRequest{
		Subject: username,
		TTL:     int64(ttl.Seconds()),
	})
	if err != nil {
		return "", err
	}

	return resp.Token, nil
}
func generateUserCredentials(ctx context.Context, pachdAddress string, adminToken string, username string, ttl time.Duration) (string, error) {
	// Setup a single use client w the given admin token / address
	client, err := pclient.NewFromAddress(pachdAddress)
	if err != nil {
		return "", err
	}
	defer client.Close() // avoid leaking connections

	client = client.WithCtx(ctx)
	client.SetAuthToken(adminToken)

	resp, err := client.AuthAPIClient.GetAuthToken(client.Ctx(), &auth.GetAuthTokenRequest{
		Subject: username,
		TTL:     int64(ttl.Seconds()),
	})
	if err != nil {
		return "", err
	}

	return resp.Token, nil
}
func generateUserCredentials ( ctx context . Context , pachdAddress string , adminToken string , username string , ttl time . Duration ) ( string , error ) { // Setup a single use client w the given admin token / address client , err := pclient . NewFromAddress ( pachdAddress ) if err != nil { return " " , err } defer client . Close ( ) // avoid leaking connections client = client . WithCtx ( ctx ) client . SetAuthToken ( adminToken ) resp , err := client . AuthAPIClient . GetAuthToken ( client . Ctx ( ) , & auth . GetAuthTokenRequest { Subject : username , TTL : int64 ( ttl . Seconds ( ) ) , } ) if err != nil { return " " , err } return resp . Token , nil }
// generateUserCredentials uses the vault plugin's Admin credentials to generate
// a new Pachyderm authentication token for 'username' (i.e. the user who is
// currently requesting a Pachyderm token from Vault).
generateUserCredentials uses the vault plugin s Admin credentials to generate a new Pachyderm authentication token for username ( i . e . the user who is currently requesting a Pachyderm token from Vault ) .