@@ -1275,19 +1275,28 @@ appsettings.json:
1275
1275
- "Security": {
1276
1276
- "Oauth2": {
1277
1277
- "Client": {
1278
- - "OAuthServiceUrl": "http://localhost:8080/uaa",
1278
+ - "Authority": "http://localhost:8080/uaa",
1279
+ - "CallbackPath": "/signin-oidc",
1279
1280
- "ClientId": "steeltoesamplesclient",
1280
- - "ClientSecret": "client_secret"
1281
+ - "ClientSecret": "client_secret",
1282
+ - "MetadataAddress": "http://localhost:8080/.well-known/openid-configuration",
1283
+ - "AdditionalScopes": "profile sampleapi.read",
1284
+ - "SaveTokens": true,
1285
+ - "RequireHttpsMetadata": false
1281
1286
- }
1282
1287
- }
1283
1288
- }
1284
1289
+ "Authentication": {
1285
1290
+ "Schemes": {
1286
1291
+ "OpenIdConnect": {
1287
1292
+ "Authority": "http://localhost:8080/uaa",
1288
- + "ClientId": "steeltoesamplesserver",
1289
- + "ClientSecret": "server_secret",
1293
+ + "CallbackPath": "/signin-oidc",
1294
+ + "ClientId": "steeltoesamplesclient",
1295
+ + "ClientSecret": "client_secret",
1296
+ + "MetadataAddress": "http://localhost:8080/.well-known/openid-configuration",
1290
1297
+ "RequireHttpsMetadata": false
1298
+ + "SaveTokens": true,
1299
+ + "Scope": [ "openid", "sampleapi.read" ],
1291
1300
+ }
1292
1301
+ }
1293
1302
+ }
@@ -1303,6 +1312,7 @@ Program.cs:
1303
1312
using Microsoft.AspNetCore.Authentication.Cookies;
1304
1313
+ using Microsoft.AspNetCore.Authentication.OpenIdConnect;
1305
1314
- using Microsoft.AspNetCore.HttpOverrides;
1315
+ - using Microsoft.Extensions.Options;
1306
1316
- using Steeltoe.Extensions.Configuration.CloudFoundry;
1307
1317
+ using Steeltoe.Configuration.CloudFoundry;
1308
1318
- using Steeltoe.Security.Authentication.CloudFoundry;
@@ -1329,14 +1339,12 @@ var app = builder.Build();
1329
1339
- ForwardedHeaders = ForwardedHeaders.XForwardedProto
1330
1340
- });
1331
1341
1332
- app.UseRouting();
1333
-
1334
1342
app.UseAuthentication();
1335
1343
app.UseAuthorization();
1336
1344
```
1337
1345
1338
1346
> [ !NOTE]
1339
- > The code above should also be used for applications that previously used ` .AddCloudFoundryOAuth(builder.Configuration); `
1347
+ > Use the code above for applications that previously used ` .AddCloudFoundryOAuth(builder.Configuration); ` .
1340
1348
1341
1349
### JWT Bearer
1342
1350
@@ -1360,9 +1368,12 @@ appsettings.json:
1360
1368
- "Security": {
1361
1369
- "Oauth2": {
1362
1370
- "Client": {
1363
- - "OAuthServiceUrl ": "http://localhost:8080/uaa",
1371
+ - "AuthDomain ": "http://localhost:8080/uaa",
1364
1372
- "ClientId": "steeltoesamplesserver",
1365
1373
- "ClientSecret": "server_secret",
1374
+ - "JwtKeyUrl": "http://localhost:8080/token_keys",
1375
+ - "MetadataAddress": "http://localhost:8080/.well-known/openid-configuration",
1376
+ - "RequireHttpsMetadata": false
1366
1377
- }
1367
1378
- }
1368
1379
- }
@@ -1408,8 +1419,6 @@ var app = builder.Build();
1408
1419
- ForwardedHeaders = ForwardedHeaders.XForwardedProto
1409
1420
- });
1410
1421
1411
- app.UseRouting();
1412
-
1413
1422
app.UseAuthentication();
1414
1423
app.UseAuthorization();
1415
1424
```
@@ -1491,7 +1500,7 @@ var builder = WebApplication.CreateBuilder(args);
1491
1500
- {
1492
1501
- var options = services.GetRequiredService<IOptions<CertificateOptions>>();
1493
1502
- var b64 = Convert.ToBase64String(options.Value.Certificate.Export(X509ContentType.Cert));
1494
- - client.DefaultRequestHeaders.Add("X-Forwarded- Client-Cert", b64);
1503
+ - client.DefaultRequestHeaders.Add("X-Client-Cert", b64);
1495
1504
- });
1496
1505
+ builder.Services.AddHttpClient("withCertificate").AddAppInstanceIdentityCertificate();
1497
1506
```
0 commit comments