Skip to content

nomad login errors before determining the default auth method type #16501

@xkisu

Description

@xkisu

Nomad version

v1.5.0

Operating system and Environment details

Ubuntu 22.04.2 LTS

Issue

The documentation for the nomad login command and the integration guide here state that the type flag is optional if an admin has configured a default, however this is not the case.

Line 117 in login.go explicitly rejects any calls to nomad login that don't have OIDC set as the type:

switch l.authMethodType {
case api.ACLAuthMethodTypeOIDC:
default:
	l.Ui.Error(fmt.Sprintf("Unsupported authentication type %q", l.authMethodType))
	return 1
}

There is a check further down for a default auth method, at line 143 that will set the type to be the type of the default auth method, but that section of the code is never reached because the switch statement above returns an error before it can try to determine the default type.

Reproduction steps

  1. Register an auth method with Nomad (i.e. following this guide)
  2. Make sure the auth method is set as default (nomad acl auth-method info vault)
  3. Try to run nomad login without specifying the type, you'll receive an error Unsupported authentication type ""

Expected Result

It should be selecting the default auth method and using the type from that. These is code defined in the command to do so, but the switch statement further up cancels it out before it can try to determine the default.

Actual Result

Unsupported authentication type ""

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions