Skip to content

Commit 87ac38e

Browse files
committed
full edit Security topics + some consistency changes
1 parent 8f2d1b7 commit 87ac38e

File tree

8 files changed

+146
-116
lines changed

8 files changed

+146
-116
lines changed

api/v4/connectors/redis.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
1-
# Redis
1+
# Redis/Valkey
22

33
This connector simplifies accessing [Redis](https://redis.io/) databases.
4+
5+
> [!NOTE]
6+
> Redis has been updated to [Valkey](https://valkey.io/topics/migration/).
7+
48
It supports the following .NET drivers:
9+
510
- [StackExchange.Redis](https://www.nuget.org/packages/StackExchange.Redis), which provides an `IConnectionMultiplexer`.
611
- [Microsoft.Extensions.Caching.StackExchangeRedis](https://www.nuget.org/packages/Microsoft.Extensions.Caching.StackExchangeRedis), which provides an `IDistributedCache`.
712

api/v4/management/prometheus.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ The specific port is not important to Steeltoe, it only matters that the binding
153153

154154
Install the metrics-registrar plugin and use it to register your endpoint:
155155

156-
```shell
156+
```bash
157157
cf install-plugin -r CF-Community "metric-registrar"
158158
cf register-metrics-endpoint APP-NAME /actuator/prometheus --internal-port 8091
159159
```
@@ -166,7 +166,7 @@ cf register-metrics-endpoint APP-NAME /actuator/prometheus --internal-port 8091
166166

167167
The result of using the metrics registrar plugin is a user-provided service, which can also be created and bound manually.
168168

169-
```shell
169+
```bash
170170
cf create-user-provided-service APP-NAME -l secure-endpoint://:8091/actuator/prometheus
171171
cf bind-service APP-NAME SERVICE-NAME
172172
```

api/v4/management/tasks.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ As a matter of best practice, it is recommended that you provide the `RunTask` v
111111
However, due to the way .NET configuration works, it doesn't matter which configuration provider is used to provide the task name.
112112
Invoking the command on Cloud Foundry looks similar to this:
113113

114-
```
114+
```bash
115115
cf run-task YourAppName "dotnet run -- RunTask=ExampleTaskName" --name ExampleTaskName
116116
```
117117

api/v4/security/certificate.md

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -5,31 +5,31 @@ Certificate Authentication, also known as Mutual TLS, is a way for a client and
55
This library is a supplement to [ASP.NET Core Certificate Authentication](https://learn.microsoft.com/aspnet/core/security/authentication/certauth), adding functionality that helps you use [Cloud Foundry Instance Identity certificates](https://docs.cloudfoundry.org/devguide/deploy-apps/instance-identity.html) and authorization policies based on certificate data.
66
Additionally, resources are included for automatically generating certificates for local development that resemble what is found on the platform.
77

8-
## Usage
8+
## Using Mutual TLS in ASP.NET Core
99

10-
In order to use this provider, the following steps are required:
10+
To use this provider, the following steps are required:
1111

12-
1. Add NuGet package reference
13-
1. Add identity certificates to the configuration
14-
1. Add and use the security provider in the application
15-
1. Secure your endpoints
16-
1. Attach certificate to requests to secured endpoints
12+
1. Add NuGet package reference.
13+
1. Add identity certificates to the configuration.
14+
1. Add and use the security provider in the application.
15+
1. Secure your endpoints.
16+
1. Attach certificate to requests to secured endpoints.
1717

1818
### Add NuGet Reference
1919

2020
> [!NOTE]
21-
> This step is required on all applications that are sending or receiving certificate-authorized requests.
21+
> This step is required for all applications that are sending or receiving certificate-authorized requests.
2222
23-
To use Certificate Authorization, you need to add a reference to the `Steeltoe.Security.Authorization.Certificate` NuGet package.
23+
To use Certificate Authorization, add a reference to the `Steeltoe.Security.Authorization.Certificate` NuGet package.
2424

2525
### Add Identity Certificates to Configuration
2626

2727
> [!NOTE]
28-
> This step is required on all applications that are sending or receiving certificate-authorized requests.
28+
> This step is required for all applications that are sending or receiving certificate-authorized requests.
2929
3030
In a Cloud Foundry environment, instance identity certificates are automatically provisioned (and rotated on a regular basis) for each application instance.
3131
Steeltoe provides the extension method `AddAppInstanceIdentityCertificate` to find the location of the certificate files from the environment variables `CF_INSTANCE_CERT` and `CF_INSTANCE_KEY`.
32-
When running outside of Cloud Foundry, this method will automatically generate similar certificates.
32+
When running outside of Cloud Foundry, this method automatically generates similar certificates.
3333
Use the optional parameters to coordinate `orgId` and/or `spaceId` between your applications to facilitate communication when running outside of Cloud Foundry.
3434

3535
This code adds the certificate paths to the configuration for use later (and generates the instance identity certificate when running outside Cloud Foundry):
@@ -44,25 +44,25 @@ var builder = WebApplication.CreateBuilder(args);
4444
builder.Configuration.AddAppInstanceIdentityCertificate(new Guid(orgId), new Guid(spaceId));
4545
```
4646

47-
When running locally, the code shown above will create a chain of self-signed certificates and the application instance identity certificate will have a subject containing an OrgId of `a8fef16f-94c0-49e3-aa0b-ced7c3da6229` and a SpaceId of `122b942a-d7b9-4839-b26e-836654b9785f`.
47+
When running locally, the preceding code sample creates a chain of self-signed certificates. The application instance identity certificate is created with a subject containing an OrgId of `a8fef16f-94c0-49e3-aa0b-ced7c3da6229` and a SpaceId of `122b942a-d7b9-4839-b26e-836654b9785f`.
4848
A root certificate and intermediate certificate are created on disk one level above the current project in a directory named `GeneratedCertificates`.
49-
The root and intermediate certificates will automatically be shared between applications housed within the same solution, so that the applications will be able to trust each other.
49+
The root and intermediate certificates are automatically shared between applications housed within the same solution, so that the applications can trust each other.
5050

5151
### Add and use Certificate Authentication
5252

5353
> [!NOTE]
54-
> This section is only required on applications that are receiving certificate-authorized requests.
54+
> This section is required only on applications that are receiving certificate-authorized requests.
5555
5656
Several steps need to happen before certificate authorization policies can be used to secure resources:
5757

58-
1. Configuration values need to be bound into named `CertificateOptions`
59-
1. Certificate files need to be monitored for changes (to stay up to date when certificates are rotated)
60-
1. Certificate forwarding needs to be configured (so that ASP.NET reads the certificate out of an HTTP Header)
61-
1. Authentication services need to be added
62-
1. Authorization services and policies need to be added
63-
1. Middleware needs to be activated
58+
1. Bind configuration values into named `CertificateOptions`.
59+
2. Monitor certificate files for changes (to stay up to date when certificates are rotated).
60+
3. Configure certificate forwarding (so that ASP.NET reads the certificate from an HTTP Header).
61+
4. Add authentication services.
62+
5. Add authorization services and policies.
63+
6. Activate middleware.
6464

65-
Fortunately, all of the requirements can be satisfied with a handful of extension methods:
65+
Fortunately, all of these requirements can be satisfied with a handful of extension methods:
6666

6767
```csharp
6868
using Steeltoe.Security.Authorization.Certificate;
@@ -108,12 +108,12 @@ app.UseCertificateAuthorization();
108108
### Securing Endpoints
109109

110110
> [!NOTE]
111-
> This step is only required on applications that are receiving certificate-authorized requests.
111+
> This step is required only on applications that are receiving certificate-authorized requests.
112112
113-
As implied by the name of the extension method `AddOrgAndSpacePolicies` from the previous section on this page, Steeltoe provides policies for validating that a request came from an application in the same org and/or the same space. You can secure endpoints by using the standard ASP.NET Core `Authorize` attribute with these security policies.
113+
As implied by the name of the extension method `AddOrgAndSpacePolicies` (from the previous section in this topic), Steeltoe provides policies for validating that a request came from an application in the same org and/or the same space. You can secure endpoints using the standard ASP.NET Core `Authorize` attribute with these security policies.
114114

115115
> [!NOTE]
116-
> If needed, see the Microsoft documentation about [authorization in ASP.NET Core](https://learn.microsoft.com/aspnet/core/security/authorization/introduction) for a better understanding of how to use these attributes.
116+
> For more information about authorization in ASP.NET Core, see the [Microsoft documentation](https://learn.microsoft.com/aspnet/core/security/authorization/introduction).
117117
118118
The following example shows a controller using the security attributes with the included policies:
119119

@@ -153,18 +153,18 @@ In the preceding example, when an incoming request is made to the `SameOrgCheck`
153153

154154
### Communicating with Secured Services
155155

156-
In order to use app instance identity certificates in a client application, services need to be configured, but nothing needs to be activated in the ASP.NET Core request pipeline.
156+
To use app instance identity certificates in a client application, services must be configured, but nothing needs to be activated in the ASP.NET Core request pipeline.
157157

158158
#### IHttpClientFactory integration
159159

160160
> [!NOTE]
161-
> This step is only required on applications that are sending certificate-authorized requests.
161+
> This step is required only on applications that are sending certificate-authorized requests.
162162
163-
For applications that need to send identity certificates in outgoing requests, Steeltoe provides a smooth experience through an extension method on `IHttpClientBuilder` named `AddAppInstanceIdentityCertificate`.
163+
For applications that need to send identity certificates in outgoing requests, Steeltoe provides a smooth experience through an extension method on `IHttpClientBuilder` called `AddAppInstanceIdentityCertificate`.
164164
This method invokes code that handles loading certificates from paths defined in the application's configuration, monitors those file paths and their content for changes, and places the certificate in an HTTP header named `X-Client-Cert` on all outbound requests.
165165

166166
> [!NOTE]
167-
> If needed, see the Microsoft documentation about [IHttpClientFactory](https://learn.microsoft.com/aspnet/core/fundamentals/http-requests) for details.
167+
> For more information about IHttpClientFactory, see the [Microsoft documentation](https://learn.microsoft.com/aspnet/core/fundamentals/http-requests).
168168
169169
```csharp
170170
using Steeltoe.Security.Authorization.Certificate;

api/v4/security/index.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,6 @@ Choose from the following options when using Cloud Foundry security integration:
1111
In addition to authentication and authorization providers, Steeltoe security offers:
1212

1313
* [A security provider for using Redis on Cloud Foundry with ASP.NET Core Data Protection Key Ring storage](redis-key-storage-provider.md)
14+
15+
> [!NOTE]
16+
> Redis has been updated to [Valkey](https://valkey.io/topics/migration/).

0 commit comments

Comments
 (0)