You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
flag, which always strictly validates that the audience is equal to the issuer and validates the token's
399
+
You can enable strict audience validation by setting [`StrictClientAssertionAudienceValidation`](/identityserver/reference/v8/options.md#main)
400
+
to `true`. When enabled, IdentityServer strictly validates that the audience is equal to the issuer identifier and validates the token's
402
401
`typ` header, as specified in [RFC 7523 bis](https://datatracker.ietf.org/doc/draft-ietf-oauth-rfc7523bis/).
403
402
404
-
When *`StrictClientAssertionAudienceValidation`* is not enabled, validation behavior is determined based
403
+
`StrictClientAssertionAudienceValidation` defaults to `false`. When `false`, IdentityServer accepts the following legacy audience values in addition to the issuer identifier:
404
+
405
+
* The token endpoint URL
406
+
* The CIBA endpoint URL
407
+
* The PAR endpoint URL
408
+
409
+
When `StrictClientAssertionAudienceValidation` is `false`, validation behavior is also determined based
405
410
on the `typ` header being present. When the token sets the `typ` header to `client-authentication+jwt`,
406
411
IdentityServer assumes the client's intention is to apply strict audience validation.
description: "How to subclass AuthorizeInteractionPageHttpWriter to customize how IdentityServer redirects users to login, consent, and other interaction pages."
4
+
date: 2026-05-08
5
+
sidebar:
6
+
label: "Custom redirect writer"
7
+
order: 55
8
+
---
9
+
10
+
When IdentityServer needs to send a user to an interaction page, like login, consent, create-account, or a [custom page](/identityserver/ui/custom.md),
11
+
it builds a redirect URL and writes an HTTP 303 response. The class responsible for this is `AuthorizeInteractionPageHttpWriter`, which is public and designed to be subclassed.
12
+
13
+
You might want to customize this behavior to:
14
+
15
+
* Set a cookie before the redirect (for example, to carry state that survives the round-trip through the interaction page).
16
+
* Append a custom query parameter to the interaction page URL (for example, a tenant identifier or a UI hint).
17
+
* Change the redirect status code or add extra response headers.
18
+
19
+
## How it works
20
+
21
+
`AuthorizeInteractionPageHttpWriter` implements `IHttpResponseWriter<AuthorizeInteractionPageResult>` and exposes three virtual methods you can override independently:
|`BuildReturnUrlAsync`| Builds the URL that points back to the authorize callback endpoint. |
26
+
|`BuildRedirectUrlAsync`| Combines the interaction page URL with the return URL. |
27
+
|`WriteResponseAsync`| Writes the HTTP response (status code, `Location` header). |
28
+
29
+
The default `WriteHttpResponse` implementation calls all three in sequence. You only need to override the method that covers the behavior you want to change.
30
+
31
+
## Example: appending a custom query parameter
32
+
33
+
The example below adds a `ui_hint` query parameter to every redirect URL so the interaction page can adjust its appearance based on the originating client.
This replaces the default `AuthorizeInteractionPageHttpWriter` for `AuthorizeInteractionPageResult` responses. All other result types keep their default writers.
107
+
108
+
:::note
109
+
The return URL built by `BuildReturnUrlAsync` points back into the authorize endpoint. Validate it using the [interaction service](/identityserver/reference/v8/services/interaction-service.md)
110
+
before following it in your interaction page to guard against open-redirect attacks.
Copy file name to clipboardExpand all lines: astro/src/content/docs/identityserver/ui/server-side-sessions/index.md
+7Lines changed: 7 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -100,3 +100,10 @@ When listing sessions, prefer `GetSessionsAsync` over `QuerySessionsAsync`.
100
100
The `QuerySessionsAsync` method performs a full-text search and may be slower to retrieve a list of sessions than `GetSessionsAsync`.
101
101
Use `QuerySessionsAsync` only when more advanced filtering is required for the solution you are building.
102
102
:::
103
+
104
+
### Session Overwrite and Orphaned Grant Cleanup
105
+
106
+
When a session cookie key is reused by a different user or a new session, IdentityServer automatically revokes the grants that belonged to the previous session.
107
+
This keeps your token store clean and prevents tokens from a prior user's session from remaining valid after the session is overwritten.
108
+
109
+
See [Session Management](/identityserver/ui/server-side-sessions/session-management.md#orphaned-grant-revocation-on-session-overwrite) for details.
0 commit comments