Repository navigation
Feat/replace login tokens #83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
289b658
feat(managedprincipal): replace a managed principal's login tokens in…
grokify f263e91
test(managedprincipal): cover replacing login tokens
grokify 6a73560
docs(managedprincipal): document replacing a card's login tokens
grokify 06d5ec1
docs(release): add v0.32.0 changelog and release notes
grokify 19553ad
feat(systemauth): show linked sign-in methods and link back to the app
grokify 53b650d
test(systemauth): cover the sign-in methods page and its return_to
grokify c6be3bb
docs(systemauth): document linked methods and return_to on sign-in me…
grokify 76fc4da
docs(release): add sign-in methods changes to v0.32.0
grokify 0d8d277
fix(managedprincipal): check a login token's issuer under the princip…
grokify 8630cb2
test(managedprincipal): cover a removal racing an issue, and concurre…
grokify 20e9ef0
docs(release): add the issuer check under the lock to v0.32.0
grokify File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| # v0.32.0 | ||
|
|
||
| **Release Date:** 2026-11-05 | ||
|
|
||
| A manager can now replace a managed principal's printed card in one step, | ||
| and the sign-in methods page becomes a page an application can send people | ||
| to from its own settings. | ||
|
|
||
| - **Replace login tokens.** `managedprincipal.Service.ReplaceLoginTokens` | ||
| revokes every live login token of a managed principal and issues one new | ||
| token, in one transaction. It takes the same input as `IssueLoginToken` | ||
| (name, single use, expiry) and is authorized the same way, by | ||
| `manage_credentials`. If issuing fails, nothing is revoked, so a failure | ||
| leaves the old card working rather than none. Two replaces at once on | ||
| PostgreSQL leave one token. Sessions already signed in with an old token | ||
| keep running; `RevokeAll` ends them too. | ||
| - **Over HTTP.** `managedprincipal.NewHandler` serves it as | ||
| `POST /{principalID}/login-tokens/replace`, with the issue body. It answers | ||
| 201 with the new token and `revoked`, the number of tokens it revoked. | ||
| `mpclient.Client.ReplaceLoginTokens` calls it. | ||
| - **Audited once.** A replace emits `managed_principal.login_tokens_replaced` | ||
| with the new token's identifiers and the number revoked. | ||
| - **Checked under the lock.** Issuing and replacing now check the issuer's | ||
| authority under the managed principal's row lock, in the transaction that | ||
| issues, as removing a manager does. A manager removed at the same moment | ||
| can no longer be issued a token, which `IssueLoginToken` previously | ||
| allowed. | ||
|
|
||
| Tokens are stored only as hashes, so a lost or shared card cannot be printed | ||
| again from what is stored; replacing it is how a card is reprinted. | ||
|
|
||
| ## Sign-in methods | ||
|
|
||
| - **What is linked.** `/account/sign-in-methods` shows the account's email | ||
| and the providers already linked to it, and offers a **Link** button only | ||
| for the others. Directories list linked providers through the optional | ||
| `LinkedProviderLister` interface, which the Ent and memory directories | ||
| implement; with another directory the page offers every provider, as | ||
| before. | ||
| - **Back to the application.** An application links to the page with | ||
| `return_to`, such as | ||
| `https://auth.example.com/account/sign-in-methods?return_to=https://app.example.com/settings`. | ||
| It passes the same allowlist as sign-in's `return_to` (a path on the | ||
| issuer, or an origin in `allowed_redirect_origins`) and shows a | ||
| **Back to** link, named by `signed_out_name` or else its host. It is kept | ||
| through signing in first, the link button, the provider and the return to | ||
| the page, and validated again at each step. An invalid `return_to` is | ||
| ignored. | ||
|
|
||
| The release adds no breaking change. | ||
|
|
||
| ## Upgrading | ||
|
|
||
| Nothing is required. Applications that print login cards can offer "Replace | ||
| card" with the new call instead of revoking each token and issuing a new | ||
| one. Applications can link their account settings to | ||
| `/account/sign-in-methods?return_to=<their settings page>`. | ||
|
|
||
| See [Replacing a Card](../identity/managed-principals.md#replacing-a-card) and | ||
| [Linking sign-in methods](../systemauth/social-login.md#linking-sign-in-methods). | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.