Skip to content

Commit 7ec21fe

Browse files
committed
PR feedback + make code work w/Steeltoe UAA image
1 parent d0806e2 commit 7ec21fe

File tree

1 file changed

+20
-11
lines changed

1 file changed

+20
-11
lines changed

docs/docs/v4/welcome/migrate-quick-steps.md

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1275,19 +1275,28 @@ appsettings.json:
12751275
- "Security": {
12761276
- "Oauth2": {
12771277
- "Client": {
1278-
- "OAuthServiceUrl": "http://localhost:8080/uaa",
1278+
- "Authority": "http://localhost:8080/uaa",
1279+
- "CallbackPath": "/signin-oidc",
12791280
- "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
12811286
- }
12821287
- }
12831288
- }
12841289
+ "Authentication": {
12851290
+ "Schemes": {
12861291
+ "OpenIdConnect": {
12871292
+ "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",
12901297
+ "RequireHttpsMetadata": false
1298+
+ "SaveTokens": true,
1299+
+ "Scope": [ "openid", "sampleapi.read" ],
12911300
+ }
12921301
+ }
12931302
+ }
@@ -1303,6 +1312,7 @@ Program.cs:
13031312
using Microsoft.AspNetCore.Authentication.Cookies;
13041313
+using Microsoft.AspNetCore.Authentication.OpenIdConnect;
13051314
-using Microsoft.AspNetCore.HttpOverrides;
1315+
-using Microsoft.Extensions.Options;
13061316
-using Steeltoe.Extensions.Configuration.CloudFoundry;
13071317
+using Steeltoe.Configuration.CloudFoundry;
13081318
-using Steeltoe.Security.Authentication.CloudFoundry;
@@ -1329,14 +1339,12 @@ var app = builder.Build();
13291339
- ForwardedHeaders = ForwardedHeaders.XForwardedProto
13301340
-});
13311341

1332-
app.UseRouting();
1333-
13341342
app.UseAuthentication();
13351343
app.UseAuthorization();
13361344
```
13371345

13381346
> [!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);`.
13401348
13411349
### JWT Bearer
13421350

@@ -1360,9 +1368,12 @@ appsettings.json:
13601368
- "Security": {
13611369
- "Oauth2": {
13621370
- "Client": {
1363-
- "OAuthServiceUrl": "http://localhost:8080/uaa",
1371+
- "AuthDomain": "http://localhost:8080/uaa",
13641372
- "ClientId": "steeltoesamplesserver",
13651373
- "ClientSecret": "server_secret",
1374+
- "JwtKeyUrl": "http://localhost:8080/token_keys",
1375+
- "MetadataAddress": "http://localhost:8080/.well-known/openid-configuration",
1376+
- "RequireHttpsMetadata": false
13661377
- }
13671378
- }
13681379
- }
@@ -1408,8 +1419,6 @@ var app = builder.Build();
14081419
- ForwardedHeaders = ForwardedHeaders.XForwardedProto
14091420
-});
14101421

1411-
app.UseRouting();
1412-
14131422
app.UseAuthentication();
14141423
app.UseAuthorization();
14151424
```
@@ -1491,7 +1500,7 @@ var builder = WebApplication.CreateBuilder(args);
14911500
-{
14921501
- var options = services.GetRequiredService<IOptions<CertificateOptions>>();
14931502
- 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);
14951504
-});
14961505
+builder.Services.AddHttpClient("withCertificate").AddAppInstanceIdentityCertificate();
14971506
```

0 commit comments

Comments
 (0)