@@ -1267,12 +1267,12 @@ appsettings.json:
1267
1267
"Client": {
1268
1268
- "AuthDomain": "http://localhost:8080",
1269
1269
+ "Authority": "http://localhost:8080/uaa",
1270
- "CallbackPath": "/signin-oidc",
1271
- "ClientId": "steeltoesamplesclient",
1272
- "ClientSecret": "client_secret",
1273
1270
+ "MetadataAddress": "http://localhost:8080/.well-known/openid-configuration",
1274
1271
+ "RequireHttpsMetadata": false,
1275
- + "AdditionalScopes": "sampleapi.read"
1272
+ + "AdditionalScopes": "sampleapi.read",
1273
+ "CallbackPath": "/signin-oidc",
1274
+ "ClientId": "steeltoesamplesclient",
1275
+ "ClientSecret": "client_secret"
1276
1276
}
1277
1277
}
1278
1278
}
@@ -1345,9 +1345,9 @@ appsettings.json:
1345
1345
- "ClientId": "steeltoesamplesclient",
1346
1346
- "ClientSecret": "client_secret",
1347
1347
- "MetadataAddress": "http://localhost:8080/.well-known/openid-configuration",
1348
- - "AdditionalScopes ": "sampleapi.read" ,
1348
+ - "RequireHttpsMetadata ": false ,
1349
1349
- "SaveTokens": true,
1350
- - "RequireHttpsMetadata ": false
1350
+ - "AdditionalScopes ": "sampleapi.read"
1351
1351
- }
1352
1352
- }
1353
1353
- }
@@ -1531,9 +1531,9 @@ var builder = WebApplication.CreateBuilder(args);
1531
1531
- builder.Configuration.AddCloudFoundryContainerIdentity(orgId, spaceId);
1532
1532
+ builder.Configuration.AddAppInstanceIdentityCertificate(new Guid(orgId), new Guid(spaceId));
1533
1533
1534
- - builder.Services.AddCloudFoundryCertificateAuth(options => options.CertificateHeader = "X-Client-Cert");
1534
+ - builder.Services.AddCloudFoundryCertificateAuth(options => options.CertificateHeader = "X-Forwarded- Client-Cert");
1535
1535
+ builder.Services.AddAuthentication().AddCertificate();
1536
- + builder.Services.AddAuthorizationBuilder().AddOrgAndSpacePolicies();
1536
+ + builder.Services.AddAuthorizationBuilder().AddOrgAndSpacePolicies("X-Forwarded-Client-Cert" );
1537
1537
1538
1538
var app = builder.Build();
1539
1539
@@ -1558,6 +1558,24 @@ app.MapGet("/sameSpace", async httpContext =>
1558
1558
+ .RequireAuthorization(CertificateAuthorizationPolicies.SameSpace);
1559
1559
```
1560
1560
1561
+ > [ !NOTE]
1562
+ > Prior to Steeltoe 3.3.0, Steeltoe Certificate Auth used the header ` X-Forwarded-Client-Cert ` , which was not configurable.
1563
+ > The code shown above is provided for compatibility between the versions. The preferred header name is ` X-Client-Cert ` .
1564
+ > In Steeltoe 4.0, the default header is ` X-Client-Cert ` , so the parameter can be omitted if cross-compatibility is not required.
1565
+
1566
+ launchsettings.json (server-side):
1567
+
1568
+ ``` diff
1569
+ {
1570
+ "profiles": {
1571
+ "http": {
1572
+ "commandName": "Project",
1573
+ "applicationUrl": "https://+:7107" // bind to all host names and IP addresses
1574
+ }
1575
+ }
1576
+ }
1577
+ ```
1578
+
1561
1579
Program.cs (client-side):
1562
1580
1563
1581
``` diff
@@ -1579,13 +1597,13 @@ var builder = WebApplication.CreateBuilder(args);
1579
1597
builder.Services
1580
1598
- .AddHttpClient<PingClient>((services, client) =>
1581
1599
- {
1582
- - client.BaseAddress = new Uri("http ://example-service/ ")
1600
+ - client.BaseAddress = new Uri("https ://localhost:7107 ")
1583
1601
- var options = services.GetRequiredService<IOptions<CertificateOptions>>();
1584
1602
- var b64 = Convert.ToBase64String(options.Value.Certificate.Export(X509ContentType.Cert));
1585
- - client.DefaultRequestHeaders.Add("X-Client-Cert", b64);
1603
+ - client.DefaultRequestHeaders.Add("X-Forwarded- Client-Cert", b64);
1586
1604
- });
1587
- + .AddHttpClient<PingClient>(httpClient => httpClient.BaseAddress = new Uri("http ://example-service/ "))
1588
- + .AddAppInstanceIdentityCertificate();
1605
+ + .AddHttpClient<PingClient>(httpClient => httpClient.BaseAddress = new Uri("https ://localhost:7107 "))
1606
+ + .AddAppInstanceIdentityCertificate("X-Forwarded-Client-Cert" );
1589
1607
1590
1608
var app = builder.Build();
1591
1609
@@ -1604,6 +1622,11 @@ public class PingClient(HttpClient httpClient)
1604
1622
}
1605
1623
```
1606
1624
1625
+ > [ !NOTE]
1626
+ > Prior to Steeltoe 3.3.0, Steeltoe Certificate Auth used the header ` X-Forwarded-Client-Cert ` , which was not configurable.
1627
+ > The code shown above is provided for compatibility between the versions. The preferred header name is ` X-Client-Cert ` .
1628
+ > In Steeltoe 4.0, the default header is ` X-Client-Cert ` , so the parameter can be omitted if cross-compatibility is not required.
1629
+
1607
1630
### DataProtection Key Store using Redis/Valkey
1608
1631
1609
1632
``` diff
0 commit comments