Skip to content

Commit f110a00

Browse files
Merge pull request #884 from DuendeSoftware/ka/use-pathbase
Add PathBaseMiddleware explanation to discovery docs
2 parents 348660a + 0d28278 commit f110a00

1 file changed

Lines changed: 59 additions & 1 deletion

File tree

  • src/content/docs/identityserver/reference/endpoints

src/content/docs/identityserver/reference/endpoints/discovery.md

Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,65 @@ about your IdentityServer - it returns information like the issuer name, key mat
1616

1717
The discovery endpoint is available via `/.well-known/openid-configuration` relative to the base address, e.g.:
1818

19-
https://demo.duendesoftware.com/.well-known/openid-configuration
19+
```text
20+
https://demo.duendesoftware.com/.well-known/openid-configuration
21+
```
22+
23+
## Issuer Name and Path Base
24+
25+
When your IdentityServer is hosted in an application that uses [ASP.NET Core's `PathBaseMiddleware`](https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.builder.extensions.usepathbasemiddleware), the base path will be
26+
included in the issuer name and discovery document URLs. For example, if your application is configured with a path base
27+
of `/identity`, your configuration will look like this:
28+
29+
```csharp title="Program.cs"
30+
var builder = WebApplication.CreateBuilder(args);
31+
32+
// 👨‍💻 configure Application Host
33+
34+
var app = builder.Build();
35+
app.UseSerilogRequestLogging();
36+
37+
if (app.Environment.IsDevelopment())
38+
{
39+
app.UseDeveloperExceptionPage();
40+
}
41+
42+
// 👋 Configuring the path base
43+
app.UsePathBase("/identity");
44+
45+
app.UseStaticFiles();
46+
app.UseRouting();
47+
48+
app.UseIdentityServer();
49+
app.UseAuthorization();
50+
51+
app.MapRazorPages()
52+
.RequireAuthorization();
53+
54+
return app;
55+
```
56+
57+
And the discovery document will look like this:
58+
59+
```json title=".well-known/openid-configuration"
60+
{
61+
"issuer": "https://localhost:5001/identity",
62+
"jwks_uri": "https://localhost:5001/identity/.well-known/openid-configuration/jwks",
63+
"authorization_endpoint": "https://localhost:5001/identity/connect/authorize",
64+
"token_endpoint": "https://localhost:5001/identity/connect/token",
65+
"userinfo_endpoint": "https://localhost:5001/identity/connect/userinfo",
66+
"end_session_endpoint": "https://localhost:5001/identity/connect/endsession",
67+
"check_session_iframe": "https://localhost:5001/identity/connect/checksession",
68+
"revocation_endpoint": "https://localhost:5001/identity/connect/revocation",
69+
"introspection_endpoint": "https://localhost:5001/identity/connect/introspect",
70+
"device_authorization_endpoint": "https://localhost:5001/identity/connect/deviceauthorization",
71+
"backchannel_authentication_endpoint": "https://localhost:5001/identity/connect/ciba",
72+
"pushed_authorization_request_endpoint": "https://localhost:5001/identity/connect/par"
73+
}
74+
```
75+
76+
This can be helpful when configuring IdentityServer in a multi-tenant scenario where the base path is used to
77+
identify the tenant.
2078

2179
## .NET Client Library
2280

0 commit comments

Comments
 (0)