4
4
using System ;
5
5
using System . Security . Cryptography ;
6
6
using System . Text . Json ;
7
+ using System . Threading . Tasks ;
7
8
using Microsoft . AspNetCore . Authentication ;
8
9
using Microsoft . AspNetCore . Builder ;
9
10
using Microsoft . Extensions . DependencyInjection ;
@@ -33,6 +34,7 @@ internal static WebApplication ConfigureServices(this WebApplicationBuilder buil
33
34
. AddOpenIdConnect ( "oidc" , options =>
34
35
{
35
36
options . Authority = "https://demo.duendesoftware.com" ;
37
+ //options.Authority = "https://localhost:5001";
36
38
37
39
options . ClientId = "interactive.confidential.short" ;
38
40
options . ClientSecret = "secret" ;
@@ -46,6 +48,7 @@ internal static WebApplication ConfigureServices(this WebApplicationBuilder buil
46
48
options . Scope . Add ( "email" ) ;
47
49
options . Scope . Add ( "offline_access" ) ;
48
50
options . Scope . Add ( "api" ) ;
51
+ options . Scope . Add ( "resource1.scope1" ) ;
49
52
50
53
options . GetClaimsFromUserInfoEndpoint = true ;
51
54
options . SaveTokens = true ;
@@ -56,6 +59,12 @@ internal static WebApplication ConfigureServices(this WebApplicationBuilder buil
56
59
NameClaimType = "name" ,
57
60
RoleClaimType = "role"
58
61
} ;
62
+
63
+ options . Events . OnRedirectToIdentityProvider = ctx =>
64
+ {
65
+ ctx . ProtocolMessage . Resource = "urn:resource1" ;
66
+ return Task . CompletedTask ;
67
+ } ;
59
68
} ) ;
60
69
61
70
var rsaKey = new RsaSecurityKey ( RSA . Create ( 2048 ) ) ;
0 commit comments