Skip to content

Commit 58291c4

Browse files
authored
Merge pull request #56 from DuendeSoftware/mb/launch
Upgrade to IdentityServer v8
2 parents 4f42f7e + ee1e8f8 commit 58291c4

22 files changed

Lines changed: 127 additions & 139 deletions

src/Config.cs

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -460,21 +460,26 @@ public class Config
460460
{
461461
EntityId = "https://saml-sp1.example.com",
462462
DisplayName = "Simple SAML SP",
463-
AssertionConsumerServiceUrls = [new Uri("https://saml-sp1.example.com/acs")],
464-
AssertionConsumerServiceBinding = SamlBinding.HttpPost,
463+
AssertionConsumerServiceUrls = new List<IndexedEndpoint>
464+
{
465+
new IndexedEndpoint { Location = "https://saml-sp1.example.com/acs", Binding = SamlBinding.HttpPost, Index = 0, IsDefault = true }
466+
},
467+
AllowedScopes = { "openid", "profile" },
465468
},
466469

467470
// SP with Single Logout
468471
new SamlServiceProvider
469472
{
470473
EntityId = "https://saml-sp2.example.com",
471474
DisplayName = "SAML SP with SLO",
472-
AssertionConsumerServiceUrls = [new Uri("https://saml-sp2.example.com/acs")],
473-
AssertionConsumerServiceBinding = SamlBinding.HttpPost,
474-
SingleLogoutServiceUrl = new SamlEndpointType
475+
AssertionConsumerServiceUrls = new List<IndexedEndpoint>
476+
{
477+
new IndexedEndpoint { Location = "https://saml-sp2.example.com/acs", Binding = SamlBinding.HttpPost, Index = 0, IsDefault = true }
478+
},
479+
AllowedScopes = { "openid", "profile" },
480+
SingleLogoutServiceUrls = new List<SamlEndpointType>
475481
{
476-
Location = new Uri("https://saml-sp2.example.com/saml/slo"),
477-
Binding = SamlBinding.HttpPost,
482+
new SamlEndpointType { Location = "https://saml-sp2.example.com/saml/slo", Binding = SamlBinding.HttpPost }
478483
},
479484
},
480485

@@ -483,13 +488,15 @@ public class Config
483488
{
484489
EntityId = "https://saml-sp3.example.com",
485490
DisplayName = "SAML SP (IdP-initiated)",
486-
AssertionConsumerServiceUrls = [new Uri("https://saml-sp3.example.com/acs")],
487-
AssertionConsumerServiceBinding = SamlBinding.HttpPost,
491+
AssertionConsumerServiceUrls = new List<IndexedEndpoint>
492+
{
493+
new IndexedEndpoint { Location = "https://saml-sp3.example.com/acs", Binding = SamlBinding.HttpPost, Index = 0, IsDefault = true }
494+
},
488495
AllowIdpInitiated = true,
489-
SingleLogoutServiceUrl = new SamlEndpointType
496+
AllowedScopes = { "openid", "profile" },
497+
SingleLogoutServiceUrls = new List<SamlEndpointType>
490498
{
491-
Location = new Uri("https://saml-sp3.example.com/saml/slo"),
492-
Binding = SamlBinding.HttpPost,
499+
new SamlEndpointType { Location = "https://saml-sp3.example.com/saml/slo", Binding = SamlBinding.HttpPost }
493500
},
494501
},
495502
};

src/Duende.IdentityServer.Demo.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
</PropertyGroup>
99

1010
<ItemGroup>
11-
<PackageReference Include="Duende.IdentityModel" Version="8.0.1" />
12-
<PackageReference Include="Duende.IdentityServer" Version="8.0.0-alpha.1" />
13-
<PackageReference Include="Duende.IdentityServer.ConformanceReport" Version="0.1.0-alpha.0.3488" />
14-
<PackageReference Include="Duende.AspNetCore.Authentication.JwtBearer" Version="1.0.1" />
11+
<PackageReference Include="Duende.IdentityModel" Version="8.1.0" />
12+
<PackageReference Include="Duende.IdentityServer" Version="8.0.0" />
13+
<PackageReference Include="Duende.IdentityServer.ConformanceReport" Version="8.0.0" />
14+
<PackageReference Include="Duende.AspNetCore.Authentication.JwtBearer" Version="1.0.2" />
1515
<PackageReference Include="Serilog.AspNetCore" Version="10.0.0" />
1616
</ItemGroup>
1717

src/HostingExtensions.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,6 @@ public static WebApplication ConfigureServices(this WebApplicationBuilder builde
5353
UseX509Certificate = true
5454
});
5555
options.KeyManagement.KeyPath = "/tmp/keys";
56-
57-
options.Endpoints.EnableSamlIdpInitiatedEndpoint = true;
5856
})
5957
.AddInMemoryApiScopes(Config.ApiScopes)
6058
.AddInMemoryIdentityResources(Config.IdentityResources)

src/Pages/Account/Create/Index.cshtml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public async Task<IActionResult> OnPost()
5151
// if the user cancels, send a result back into IdentityServer as if they
5252
// denied the consent (even if this client does not require consent).
5353
// this will send back an access denied OIDC error response to the client.
54-
await _interaction.DenyAuthorizationAsync(context, AuthorizationError.AccessDenied, HttpContext.RequestAborted);
54+
await _interaction.DenyAuthorizationAsync(context, InteractionError.AccessDenied, HttpContext.RequestAborted);
5555

5656
// we can trust model.ReturnUrl since GetAuthorizationContextAsync returned non-null
5757
if (context.IsNativeClient())

src/Pages/Account/Login/Index.cshtml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public async Task<IActionResult> OnPost()
7474
// if the user cancels, send a result back into IdentityServer as if they
7575
// denied the consent (even if this client does not require consent).
7676
// this will send back an access denied OIDC error response to the client.
77-
await _interaction.DenyAuthorizationAsync(context, AuthorizationError.AccessDenied, HttpContext.RequestAborted);
77+
await _interaction.DenyAuthorizationAsync(context, InteractionError.AccessDenied, HttpContext.RequestAborted);
7878

7979
// we can trust model.ReturnUrl since GetAuthorizationContextAsync returned non-null
8080
if (context.IsNativeClient())

src/Pages/Consent/Index.cshtml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public async Task<IActionResult> OnPost()
6262
// user clicked 'no' - send back the standard 'access_denied' response
6363
if (Input.Button == "no")
6464
{
65-
grantedConsent = new ConsentResponse { Error = AuthorizationError.AccessDenied };
65+
grantedConsent = new ConsentResponse { Error = InteractionError.AccessDenied };
6666

6767
// emit event
6868
await _events.RaiseAsync(new ConsentDeniedEvent(User.GetSubjectId(), request.Client.ClientId, request.ValidatedResources.RawScopeValues), HttpContext.RequestAborted);

src/Pages/Device/Index.cshtml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public async Task<IActionResult> OnPost()
7373
{
7474
grantedConsent = new ConsentResponse
7575
{
76-
Error = AuthorizationError.AccessDenied
76+
Error = InteractionError.AccessDenied
7777
};
7878

7979
// emit event

src/Pages/Index.cshtml

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
<section class="text-center container border-bottom pb-3 mb-5">
1616
<div class="row py-lg-2">
1717
<div class="col-lg-6 col-md-8 mx-auto">
18-
<img src="duende-logo.svg" alt="Duende Software Logo" class="img-fluid w-75"/>
1918
<h1 class="fw-light">
2019
<a class="text-decoration-none" href="https://duendesoftware.com/products/identityserver">Welcome to Duende IdentityServer</a>
2120
</h1>
@@ -72,7 +71,7 @@
7271
</p>
7372
</div>
7473
<div class="card-footer p-0">
75-
<a href="/saml/metadata" rel="nofollow" class="btn btn-primary w-100">
74+
<a href="/Saml2" rel="nofollow" class="btn btn-primary w-100">
7675
Go
7776
<i class="glyphicon glyphicon-chevron-right"></i>
7877
</a>
@@ -324,7 +323,7 @@
324323
<h2 id="saml-service-providers" style="scroll-margin-top: 3em;">Demo SAML Service Providers (alpha)</h2>
325324
<p>
326325
This demo server also acts as a SAML 2.0 Identity Provider. The following service providers are configured for testing.
327-
Use the <a href="/saml/metadata">SAML metadata endpoint</a> to retrieve the IdP metadata for configuring your SP.
326+
Use the <a href="/Saml2">SAML metadata endpoint</a> to retrieve the IdP metadata for configuring your SP.
328327
</p>
329328

330329
<div id="saml-accordion" class="mb-3">
@@ -339,14 +338,20 @@
339338
<div class="card-body">
340339
<div class="card-text">
341340
Entity ID: <code>@sp.EntityId</code><br/>
342-
ACS Binding: <code>@sp.AssertionConsumerServiceBinding</code><br/>
343341
@foreach (var acs in sp.AssertionConsumerServiceUrls)
344342
{
345-
<text>ACS URL: <code>@acs</code><br/></text>
343+
<text>ACS URL: <code>@acs.Location</code> (<code>@acs.Binding</code>)<br/></text>
346344
}
347-
@if (sp.SingleLogoutServiceUrl != null)
345+
@if (sp.SingleLogoutServiceUrls.Any())
348346
{
349-
<text>SLO URL: <code>@sp.SingleLogoutServiceUrl.Location</code><br/></text>
347+
@foreach (var slo in sp.SingleLogoutServiceUrls)
348+
{
349+
<text>SLO URL: <code>@slo.Location</code><br/></text>
350+
}
351+
}
352+
@foreach (var slo in sp.SingleLogoutServiceUrls)
353+
{
354+
<text>SLO URL: <code>@slo.Location</code><br/></text>
350355
}
351356
@if (sp.AllowIdpInitiated)
352357
{

src/Pages/Index.cshtml.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Copyright (c) Duende Software. All rights reserved.
22
// See LICENSE in the project root for license information.
33

4-
using Duende.IdentityServer;
54
using System.Reflection;
65
using Microsoft.AspNetCore.Authorization;
76
using Microsoft.AspNetCore.Mvc.RazorPages;
@@ -11,17 +10,11 @@ namespace IdentityServerHost.Pages.Home;
1110
[AllowAnonymous]
1211
public class Index : PageModel
1312
{
14-
public Index(IdentityServerLicense? license = null)
15-
{
16-
License = license;
17-
}
18-
1913
public string Version
2014
{
2115
get => typeof(Duende.IdentityServer.Hosting.IdentityServerMiddleware).Assembly
2216
.GetCustomAttribute<AssemblyInformationalVersionAttribute>()
2317
?.InformationalVersion.Split('+').First()
2418
?? "unavailable";
2519
}
26-
public IdentityServerLicense? License { get; }
2720
}

src/Pages/Saml/IdpInitiated.cshtml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
@page "/saml/idp-initiated"
2+
@model Duende.IdentityServer.Demo.Pages.Saml.IdpInitiatedModel

0 commit comments

Comments
 (0)