Authentication Methods · Topic 1 of 3
Auth Method Purpose, Use Cases and Human vs System
Vault Associate (003): what auth methods do, how to choose one for a use case, and the difference between human and system (machine) auth methods.
- 4 min
- An auth method verifies a client and results in a token carrying policies.
- The token auth method is enabled by default in every Vault instance.
- Most other methods must be enabled before use, and several can be active at once.
What it is
An auth method is the part of Vault that verifies who or what a client is. It checks the client's information against an internal or external system, such as a Vault-held user list, GitHub, LDAP or a cloud provider.
When the check succeeds, Vault issues a token. The token is similar to a website session ID, and it carries the policies that were mapped at login. Every later authenticated request uses that token.
How it works
Basic facts
All Vault instances start with the token auth method enabled. Other methods must be enabled before use, and several can run at once. The same method type can be mounted at different paths.
A client needs to authenticate only once to get access. Vault cannot force a client through several methods in a row, although some methods support multi-factor authentication.
Auth methods mount under the auth/ prefix. Each method type has its own login endpoint, such as auth/approle/login.
Vault does not keep a copy of an external directory such as LDAP. It delegates the check to the auth method and maps the result to policies.
Human vs system methods
Some methods target people and others target machines. The official study guide names LDAP and GitHub as human-centric, and AWS, AppRole and Kubernetes as machine-oriented. Userpass also verifies people.
| Kind | Examples | Client proves identity with |
|---|---|---|
| Human oriented | LDAP, GitHub, userpass | A username and password, or a personal access token |
| Machine oriented | AppRole, AWS, Kubernetes | A role ID and secret ID, a cloud identity, or a service account token |
People can type a password or approve a prompt. Machines cannot, so a machine method relies on a platform identity or an issued credential that no person has to enter.
Kubernetes is a good example. A pod logs in with its service account token, and Vault validates it with the Kubernetes API.
AppRole fits applications and pipelines. The role ID acts like a username and the secret ID like a password, and the secret ID can be delivered with response wrapping.
Choosing by use case
Pick the method that matches where the client runs and what proof it already has.
| Requirement | Method that fits |
|---|---|
| Developers sign in with their company directory | LDAP |
| Developers sign in with an existing GitHub identity | GitHub |
| A CI job or application outside any cloud or cluster | AppRole |
| A pod running in Kubernetes | Kubernetes |
| A workload on AWS using its cloud identity | AWS |
| Usernames and passwords kept inside Vault itself | Userpass |
Lease and renewal
Logging in returns a token with a lease. When the lease period ends, the client must authenticate again. Before that, the token can be renewed with vault token renew without authenticating again.
How the exam asks about this
- "A Kubernetes pod needs secrets without any stored credential." Use the Kubernetes auth method with the pod's service account.
- "A Jenkins server needs to fetch secrets at deploy time." Use AppRole, which is designed for machines and applications.
- "Employees should sign in with their directory accounts." Use LDAP, a human oriented method.
What to remember for the exam
- An auth method verifies a client and results in a token carrying policies.
- The token auth method is enabled by default in every Vault instance.
- Most other methods must be enabled before use, and several can be active at once.
- Human methods include LDAP and GitHub; machine methods include AppRole, AWS and Kubernetes.
- A client authenticates with one method only; Vault does not chain methods, though some support MFA.
- Tokens from a login can be renewed before the lease ends; after that, the client logs in again.
Vault issues a token whatever the auth method is. Do not assume only the token method produces tokens; every successful login ends in one.
Common mistakes
Choosing a human method for an application. Putting a password in an app's configuration defeats the purpose. Machine methods such as AppRole, AWS or Kubernetes exist so no person has to type anything.
Thinking auth methods grant access. An auth method only proves identity. Access comes from the policies attached to the token.
Assuming the default path is fixed. The mount path defaults to the method type but can be changed. Users must then log in at the custom path.
Check yourself
What is the main purpose of an auth method?
It verifies a client's identity against an internal or external system and, on success, has Vault issue a token that carries policies.
Which kind of method suits a pod running in Kubernetes, and why?
A machine oriented method, the Kubernetes auth method, because the pod proves itself with its service account token and no person has to supply a password.
Which auth method is enabled in every new Vault instance?
The token auth method.
Topic 1 of 3 in Authentication Methods
Test yourself on Authentication Methods
The full HashiCorp Vault Associate 003 question bank has 600 questions, with timed practice exams and an explanation for every answer.
This study guide is independent and is not affiliated with, endorsed by, or sponsored by HashiCorp. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.