Skip to content

Commit 6ad6062

Browse files
authored
Merge pull request #648 from DuendeSoftware/signout-scheme-646
Add guidance for external authentication `SignOutScheme`
2 parents 1034326 + fefe241 commit 6ad6062

1 file changed

Lines changed: 35 additions & 3 deletions

File tree

src/content/docs/identityserver/ui/login/external.md

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,9 @@ read the Microsoft [docs](https://docs.microsoft.com/en-us/aspnet/core/security/
107107
ASP.NET Identity [quickstart](/identityserver/quickstarts/5-aspnetid/).
108108
:::
109109

110-
One option on an external authentication handlers is called `SignInScheme`.
110+
### Sign In Scheme
111+
112+
One option on external authentication handlers is called `SignInScheme`.
111113
This specifies the cookie handler to manage the state:
112114

113115
```cs
@@ -124,7 +126,7 @@ builder.Services.AddAuthentication()
124126
Given that this is such a common practice, IdentityServer registers a cookie handler specifically for this external
125127
provider workflow.
126128
The scheme is represented via the `IdentityServerConstants.ExternalCookieAuthenticationScheme` constant.
127-
If you were to use our external cookie handler, then for the `SignInScheme` above you'd assign the value to be the
129+
If you were to use our external cookie handler, then for the `SignInScheme` above, you'd assign the value to be the
128130
`IdentityServerConstants.ExternalCookieAuthenticationScheme` constant:
129131

130132
```cs
@@ -159,6 +161,35 @@ directly to the main cookie handler. This typically involves handling events on
159161
the correct claims transformation from the external identity source.
160162
:::
161163

164+
### Sign Out Scheme
165+
166+
`SignInScheme` of the external provider should always be `IdentityServerConstants.ExternalCookieAuthenticationScheme`.
167+
The `SignOutScheme` depends on whether **ASP.NET Identity** is used or not:
168+
169+
```csharp title="With ASP.NET Identity"
170+
// Program.cs
171+
builder.Services.AddAuthentication()
172+
.AddCookie("MyTempHandler")
173+
.AddOpenIdConnect("AAD", "Employee Login", options =>
174+
{
175+
options.SignOutScheme = IdentityConstants.ApplicationScheme
176+
// other options omitted
177+
});
178+
```
179+
180+
```csharp title="Without ASP.NET Identity"
181+
// Program.cs
182+
builder.Services.AddAuthentication()
183+
.AddCookie("MyTempHandler")
184+
.AddOpenIdConnect("AAD", "Employee Login", options =>
185+
{
186+
options.SignOutScheme = IdentityServerConstants.SignoutScheme
187+
// other options omitted
188+
});
189+
```
190+
191+
Learn more about [ASP.NET Identity and its relationship to Duende IdentityServer](/identityserver/aspnet-identity/).
192+
162193
## Handling The Callback
163194

164195
On the callback page your typical tasks are:
@@ -233,7 +264,8 @@ Typically, the `sub` value used to log the user in would be the user's unique id
233264

234265
## State, URL length, And ISecureDataFormat
235266

236-
When redirecting to an external provider for sign-in, frequently state from the client application must be round-tripped.
267+
When redirecting to an external provider for sign-in, frequently state from the client application must be
268+
round-tripped.
237269
This means that state is captured prior to leaving the client and preserved until the user has returned to the client
238270
application.
239271
Many protocols, including OpenID Connect, allow passing some sort of state as a parameter as part of the request, and

0 commit comments

Comments
 (0)