liveBook · Manning

Credential rotation

As explained in Grokking Software Architecture

Secret rotation is the practice of replacing credentials on a recurring or triggered basis while maintaining application access without unnecessary downtime.

When a database password changes, an application holding only the old password may fail its next query. Credential rotation avoids turning that change into an outage by letting the application refresh its secret and retry. section 11.5.3

When a database rejects an expired credential, the application can:

A midnight password change

If a database password changes while an application is running, an application that only fetched it at startup may fail. A design that catches the authentication error, fetches the rotated password, and retries can keep the failure from becoming a user-visible outage. AWS Secrets Manager can generate a new database password every 30 days. section 11.5.3

Manual retry logic around every query is tedious and error-prone. Spring Boot applications can pair connection pools such as HikariCP with dynamic configuration tools or Secrets Manager integrations to automate recovery. Another pattern fetches credentials at startup or after an unauthorized response. section 11.5.3 section 11.5.2

Figure 11.7 Mature architectures "catch" authentication failures and swap in fresh secrets without stopping the application.

See the recovery cycle: catch an authentication failure, replace the stale secret, and continue without stopping the application. section 11.5.3 section 11.10

How Grokking Software Architecture covers it

How deep it goes
Explains a four-step recovery flow and names framework integrations, without showing their implementation.
Examples
Uses a database password change, 30-day AWS Secrets Manager rotation, and Spring Boot integrations as examples.
What it assumes
Assumes familiarity with database credentials, application caches, and authentication errors; teaches the recovery sequence explicitly.
What you can do after
Build it by catching authentication failures, clearing cached credentials, fetching a fresh secret, and retrying the operation.
How it connects
Connects credential rotation to Secrets Managers, resilience patterns, credential caching, and database connection pools.

Also explained in

Compare how 2 books explain credential rotation →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Grokking Software Architecture. The section links point to the parts of the book it draws on.