Skip to content
Tutorials Center
My learning

Topics

Lesson 15 of 36 ยท Authentication Methods

Authentication Methods Overview

Understand how Vault authenticates users and machines: the login flow, the token as the result, human versus machine methods, and how to enable and list auth methods.

Before Vault releases anything, it needs to know who is asking. Auth methods are the plugins that verify identity. A user might log in with a username and password, an LDAP or OIDC account, or an MFA-protected SSO session; a machine might present a Kubernetes service account, a cloud IAM identity, or an AppRole credential. Whatever the method, the result is the same: a Vault token carrying policies.

This lesson explains the login flow, the human versus machine split, and how to choose. The next lessons cover specific methods in detail.

Vault is not available here, so the commands are read-only and no output is invented. Runnable examples are stand-ins that model the login flow and the method choice.

The login flow

sequenceDiagram
    participant C as Client
    participant A as Auth method (auth/approle/)
    participant T as Token store
    participant P as Policies
    C->>A: credentials (path: auth/<method>/login)
    A->>A: verify identity with the backing system
    A->>T: create token, attach policies from the role/user
    T-->>C: client_token, policies, TTL
    C->>P: later requests carry X-Vault-Token

The auth method verifies identity; the token store issues the token; policies decide what the token can do.

Each method mounts under auth/, so userpass is at auth/userpass/ and its login path is auth/userpass/login/<username>. The vault login command is a convenience that calls the right path for you.

Terminal
vault auth list                               # show enabled auth methods
vault auth enable userpass                    # enable at auth/userpass/
vault auth enable -path=corp-ldap ldap        # enable at a custom path
vault auth tune -default-lease-ttl=1h userpass/
vault auth disable userpass                   # invalidates its tokens
vault login -method=userpass username=alice

A built-in token method is always enabled and cannot be disabled; it handles tokens themselves.

Humans versus machines

Humans Machines
Typical methods OIDC/SSO, LDAP, userpass, GitHub AppRole, Kubernetes, AWS/Azure/GCP, JWT, TLS certificates
Credential Interactive: password, SSO session, MFA Platform identity or provisioned role credentials
Lifetime Hours (a working day) Minutes to hours, renewable
Risk Phishing, shared accounts Secret zero, leaked CI secrets

Prefer platform-based identity for machines: a pod's service account token or an instance's IAM identity cannot be copied to a laptop as easily as a static password. For people, connect Vault to the company identity provider so offboarding someone disables their Vault access too.

Tokens: the result of authentication

A token has:

  • an accessor (a handle that lets you look up or revoke it without seeing the token);
  • policies attached at creation;
  • a TTL and optional maximum TTL;
  • a type: service (default, with full features) or batch (lightweight, not stored, for high scale);
  • optional metadata and a number of uses.

Tokens are covered in depth in the policies and tokens chapter. For now remember: logging in always returns a token, and tokens expire.

Entities and aliases

The same person might log in through LDAP and GitHub. Vault's identity system links such logins: each login creates an alias that points at an entity, one record for one real identity. Policies can attach to the entity or to groups it belongs to, so access follows the person regardless of the method they used. You do not have to configure this to start; it matters when you manage many users.

Modelling the login flow

Python Login produces a token with policies and a TTL

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The identical error for a wrong password and an unknown user is intentional: it avoids telling attackers which usernames exist.

Choosing a method

Python A simple chooser for auth methods

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Practices

  • Enable only methods you use; every method is attack surface.
  • Give tokens the shortest TTL that works, and make clients renew or re-login.
  • Avoid long-lived static credentials for machines; if you must, use AppRole with response wrapping.
  • Apply MFA to human logins where the method allows it.
  • Never hand out the root token as a "service account".

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What does a successful login return?

    Authentication produces a token that is then presented on later requests.
  2. 2. Which method suits a pod running in Kubernetes?

    The Kubernetes auth method verifies the pod's service account token.
  3. 3. Why return the same error for wrong password and unknown user?

    Distinct messages let attackers enumerate valid accounts.
  4. 4. What links one person's logins from several methods?

    Aliases from each login point to one entity, to which policies can attach.

Summary

  • Auth methods verify identity and return a token with policies and a TTL.
  • They live under auth/; enable with vault auth enable, log in with vault login.
  • Humans use SSO/LDAP/userpass; machines should use platform identity, AppRole or JWT.
  • Entities and aliases tie multiple logins to one identity.
  • Enable few methods, keep TTLs short, and avoid long-lived static credentials.

Next: Userpass and LDAP Authentication