Skip to content

Commit 460f9b6

Browse files
guardrexpranavkm
authored andcommitted
Drop 'en-us' loc segment from URLs + doc nits (#13410)
1 parent 90231e7 commit 460f9b6

File tree

15 files changed

+50
-78
lines changed

15 files changed

+50
-78
lines changed

src/DataProtection/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
DataProtection
22
==============
33

4-
Data Protection APIs for protecting and unprotecting data. You can find documentation for Data Protection in the [ASP.NET Core Documentation](https://docs.microsoft.com/en-us/aspnet/core/security/data-protection/).
4+
Data Protection APIs for protecting and unprotecting data. You can find documentation for Data Protection in the [ASP.NET Core Documentation](https://docs.microsoft.com/aspnet/core/security/data-protection/).
55

66
## Community Maintained Data Protection Providers & Projects
77

src/ProjectTemplates/Web.ProjectTemplates/content/BlazorServerWeb-CSharp/Shared/MainLayout.Auth.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<div class="main">
88
<div class="top-row px-4">
99
<LoginDisplay />
10-
<a href="https://docs.microsoft.com/en-us/aspnet/" target="_blank">About</a>
10+
<a href="https://docs.microsoft.com/aspnet/" target="_blank">About</a>
1111
</div>
1212

1313
<div class="content px-4">

src/ProjectTemplates/Web.ProjectTemplates/content/BlazorServerWeb-CSharp/Shared/MainLayout.NoAuth.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<div class="main">
88
<div class="top-row px-4">
9-
<a href="https://docs.microsoft.com/en-us/aspnet/" target="_blank">About</a>
9+
<a href="https://docs.microsoft.com/aspnet/" target="_blank">About</a>
1010
</div>
1111

1212
<div class="content px-4">

src/Security/Authentication/Certificate/src/README.md

Lines changed: 28 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,22 @@
11
# Microsoft.AspNetCore.Authentication.Certificate
22

3-
This project sort of contains an implementation of [Certificate Authentication](https://tools.ietf.org/html/rfc5246#section-7.4.4) for ASP.NET Core.
4-
Certificate authentication happens at the TLS level, long before it ever gets to ASP.NET Core, so, more accurately this is an authentication handler
5-
that validates the certificate and then gives you an event where you can resolve that certificate to a ClaimsPrincipal.
3+
This project sort of contains an implementation of [Certificate Authentication](https://tools.ietf.org/html/rfc5246#section-7.4.4) for ASP.NET Core. Certificate authentication happens at the TLS level, long before it ever gets to ASP.NET Core, so, more accurately this is an authentication handler that validates the certificate and then gives you an event where you can resolve that certificate to a ClaimsPrincipal.
64

7-
You **must** [configure your host](#hostConfiguration) for certificate authentication, be it IIS, Kestrel, Azure Web Applications or whatever else you're using.
5+
You **must** [configure your host](#configuring-your-host-to-require-certificates) for certificate authentication, be it IIS, Kestrel, Azure Web Applications or whatever else you're using.
86

97
## Getting started
108

11-
First acquire an HTTPS certificate, apply it and then [configure your host](#hostConfiguration) to require certificates.
9+
First acquire an HTTPS certificate, apply it and then [configure your host](#configuring-your-host-to-require-certificates) to require certificates.
1210

13-
In your web application add a reference to the package, then in the `ConfigureServices` method in `startup.cs` call
14-
`app.AddAuthentication(CertificateAuthenticationDefaults.AuthenticationScheme).UseCertificateAuthentication(...);` with your options,
15-
providing a delegate for `OnValidateCertificate` to validate the client certificate sent with requests and turn that information
16-
into an `ClaimsPrincipal`, set it on the `context.Principal` property and call `context.Success()`.
11+
In your web application add a reference to the package, then in the `ConfigureServices` method in `startup.cs` call `app.AddAuthentication(CertificateAuthenticationDefaults.AuthenticationScheme).UseCertificateAuthentication(...);` with your options, providing a delegate for `OnValidateCertificate` to validate the client certificate sent with requests and turn that information into an `ClaimsPrincipal`, set it on the `context.Principal` property and call `context.Success()`.
1712

18-
If you change your scheme name in the options for the authentication handler you need to change the scheme name in
19-
`AddAuthentication()` to ensure it's used on every request which ends in an endpoint that requires authorization.
13+
If you change your scheme name in the options for the authentication handler you need to change the scheme name in `AddAuthentication()` to ensure it's used on every request which ends in an endpoint that requires authorization.
2014

21-
If authentication fails this handler will return a `403 (Forbidden)` response rather a `401 (Unauthorized)` as you
22-
might expect - this is because the authentication should happen during the initial TLS connection - by the time it
23-
reaches the handler it's too late, and there's no way to actually upgrade the connection from an anonymous connection
24-
to one with a certificate.
15+
If authentication fails this handler will return a `403 (Forbidden)` response rather a `401 (Unauthorized)` as you might expect - this is because the authentication should happen during the initial TLS connection - by the time it reaches the handler it's too late, and there's no way to actually upgrade the connection from an anonymous connection to one with a certificate.
2516

2617
You must also add `app.UseAuthentication();` in the `Configure` method, otherwise nothing will ever get called.
2718

28-
For example;
19+
For example:
2920

3021
```c#
3122
public void ConfigureServices(IServiceCollection services)
@@ -47,50 +38,41 @@ In the sample above you can see the default way to add certificate authenticatio
4738

4839
## Configuring Certificate Validation
4940

50-
The `CertificateAuthenticationOptions` handler has some built in validations that are the minimium validations you should perform on
51-
a certificate. Each of these settings are turned on by default.
41+
The `CertificateAuthenticationOptions` handler has some built in validations that are the minimum validations you should perform on a certificate. Each of these settings are turned on by default.
5242

5343
### ValidateCertificateChain
5444

55-
This check validates that the issuer for the certificate is trusted by the application host OS. If
56-
you are going to accept self-signed certificates you must disable this check.
45+
This check validates that the issuer for the certificate is trusted by the application host OS. If you are going to accept self-signed certificates you must disable this check.
5746

5847
### ValidateCertificateUse
5948

60-
This check validates that the certificate presented by the client has the Client Authentication
61-
extended key use, or no EKUs at all (as the specifications say if no EKU is specified then all EKUs
62-
are valid).
49+
This check validates that the certificate presented by the client has the Client Authentication extended key use, or no EKUs at all (as the specifications say if no EKU is specified then all EKUs are valid).
6350

6451
### ValidateValidityPeriod
6552

66-
This check validates that the certificate is within its validity period. As the handler runs on every
67-
request this ensures that a certificate that was valid when it was presented has not expired during
68-
its current session.
53+
This check validates that the certificate is within its validity period. As the handler runs on every request this ensures that a certificate that was valid when it was presented has not expired during its current session.
6954

7055
### RevocationFlag
7156

7257
A flag which specifies which certificates in the chain are checked for revocation.
7358

7459
Revocation checks are only performed when the certificate is chained to a root certificate.
7560

76-
### RevocationMode
61+
### RevocationMode
7762

7863
A flag which specifies how revocation checks are performed.
64+
7965
Specifying an on-line check can result in a long delay while the certificate authority is contacted.
8066

8167
Revocation checks are only performed when the certificate is chained to a root certificate.
8268

8369
### Can I configure my application to require a certificate only on certain paths?
8470

85-
Not possible, remember the certificate exchange is done that the start of the HTTPS conversation,
86-
it's done by the host, not the application. Kestrel, IIS, Azure Web Apps don't have any configuration for
87-
this sort of thing.
71+
Not possible, remember the certificate exchange is done that the start of the HTTPS conversation, it's done by the host, not the application. Kestrel, IIS, Azure Web Apps don't have any configuration for this sort of thing.
8872

89-
# Handler events
73+
## Handler events
9074

91-
The handler has two events, `OnAuthenticationFailed()`, which is called if an exception happens during authentication and allows you to react, and `OnValidateCertificate()` which is
92-
called after certificate has been validated, passed validation, abut before the default principal has been created. This allows you to perform your own validation, for example
93-
checking if the certificate is one your services knows about, and to construct your own principal. For example,
75+
The handler has two events, `OnAuthenticationFailed()`, which is called if an exception happens during authentication and allows you to react, and `OnValidateCertificate()` which is called after certificate has been validated, passed validation, abut before the default principal has been created. This allows you to perform your own validation, for example checking if the certificate is one your services knows about, and to construct your own principal. For example:
9476

9577
```c#
9678
services.AddAuthentication(CertificateAuthenticationDefaults.AuthenticationScheme)
@@ -117,8 +99,7 @@ services.AddAuthentication(CertificateAuthenticationDefaults.AuthenticationSchem
11799

118100
If you find the inbound certificate doesn't meet your extra validation call `context.Fail("failure Reason")` with a failure reason.
119101

120-
For real functionality you will probably want to call a service registered in DI which talks to a database or other type of
121-
user store. You can grab your service by using the context passed into your delegates, like so
102+
For real functionality you will probably want to call a service registered in DI which talks to a database or other type of user store. You can grab your service by using the context passed into your delegates, like so
122103

123104
```c#
124105
services.AddAuthentication(CertificateAuthenticationDefaults.AuthenticationScheme)
@@ -130,7 +111,7 @@ services.AddAuthentication(CertificateAuthenticationDefaults.AuthenticationSchem
130111
{
131112
var validationService =
132113
context.HttpContext.RequestServices.GetService<ICertificateValidationService>();
133-
114+
134115
if (validationService.ValidateCertificate(context.ClientCertificate))
135116
{
136117
var claims = new[]
@@ -141,17 +122,18 @@ services.AddAuthentication(CertificateAuthenticationDefaults.AuthenticationSchem
141122

142123
context.Principal = new ClaimsPrincipal(new ClaimsIdentity(claims, context.Scheme.Name));
143124
context.Success();
144-
}
125+
}
145126

146127
return Task.CompletedTask;
147128
}
148129
};
149130
});
150131
```
132+
151133
Note that conceptually the validation of the certification is an authorization concern, and putting a check on, for example, an issuer or thumbprint in an authorization policy rather
152134
than inside OnCertificateValidated() is perfectly acceptable.
153135

154-
## <a name="hostConfiguration"></a>Configuring your host to require certificates
136+
## Configuring your host to require certificates
155137

156138
### Kestrel
157139

@@ -170,12 +152,12 @@ public static IWebHost BuildWebHost(string[] args)
170152
})
171153
.Build();
172154
```
173-
You must set the `ClientCertificateValidation` delegate to `CertificateValidator.DisableChannelValidation` in order to stop Kestrel using the default OS certificate validation routine and,
174-
instead, letting the authentication handler perform the validation.
155+
156+
You must set the `ClientCertificateValidation` delegate to `CertificateValidator.DisableChannelValidation` in order to stop Kestrel using the default OS certificate validation routine and, instead, letting the authentication handler perform the validation.
175157

176158
### IIS
177159

178-
In the IIS Manager
160+
In the IIS Manager:
179161

180162
1. Select your Site in the Connections tab.
181163
2. Double click the SSL Settings in the Features View window.
@@ -185,28 +167,21 @@ In the IIS Manager
185167

186168
### Azure
187169

188-
See the [Azure documentation](https://docs.microsoft.com/en-us/azure/app-service/app-service-web-configure-tls-mutual-auth)
189-
to configure Azure Web Apps then add the following to your application startup method, `Configure(IApplicationBuilder app)` add the
190-
following line before the call to `app.UseAuthentication();`
170+
See the [Azure documentation](https://docs.microsoft.com/azure/app-service/app-service-web-configure-tls-mutual-auth) to configure Azure Web Apps then add the following to your application startup method, `Configure(IApplicationBuilder app)` add the following line before the call to `app.UseAuthentication();`:
191171

192172
```c#
193173
app.UseCertificateHeaderForwarding();
194174
```
195175

196176
### Random custom web proxies
197177

198-
If you're using a proxy which isn't IIS or Azure's Web Apps Application Request Routing you will need to configure your proxy
199-
to forward the certificate it received in an HTTP header.
200-
In your application startup method, `Configure(IApplicationBuilder app)`, add the
201-
following line before the call to `app.UseAuthentication();`
178+
If you're using a proxy which isn't IIS or Azure's Web Apps Application Request Routing you will need to configure your proxy to forward the certificate it received in an HTTP header. In your application startup method, `Configure(IApplicationBuilder app)`, add the following line before the call to `app.UseAuthentication();`:
202179

203180
```c#
204181
app.UseCertificateForwarding();
205182
```
206183

207-
You will also need to configure the Certificate Forwarding middleware to specify the header name.
208-
In your service configuration method, `ConfigureServices(IServiceCollection services)` add
209-
the following code to configure the header the forwarding middleware will build a certificate from;
184+
You will also need to configure the Certificate Forwarding middleware to specify the header name. In your service configuration method, `ConfigureServices(IServiceCollection services)` add the following code to configure the header the forwarding middleware will build a certificate from:
210185

211186
```c#
212187
services.AddCertificateForwarding(options =>
@@ -215,9 +190,7 @@ services.AddCertificateForwarding(options =>
215190
});
216191
```
217192

218-
Finally, if your proxy is doing something weird to pass the header on, rather than base 64 encoding it
219-
(looking at you nginx (╯°□°)╯︵ ┻━┻) you can override the converter option to be a func that will
220-
perform the optional conversion, for example
193+
Finally, if your proxy is doing something weird to pass the header on, rather than base 64 encoding it (looking at you nginx (╯°□°)╯︵ ┻━┻) you can override the converter option to be a func that will perform the optional conversion, for example
221194

222195
```c#
223196
services.AddCertificateForwarding(options =>
@@ -231,4 +204,3 @@ services.AddCertificateForwarding(options =>
231204
}
232205
});
233206
```
234-

src/Security/Authentication/MicrosoftAccount/src/MicrosoftChallengeProperties.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
namespace Microsoft.AspNetCore.Authentication.MicrosoftAccount
55
{
66
/// <summary>
7-
/// See https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-auth-code-flow#request-an-authorization-code for reference
7+
/// See https://docs.microsoft.com/azure/active-directory/develop/v2-oauth2-auth-code-flow#request-an-authorization-code for reference
88
/// </summary>
99
public class MicrosoftChallengeProperties : OAuthChallengeProperties
1010
{

src/Security/Authentication/Negotiate/test/Negotiate.FunctionalTest/CrossMachineReadMe.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
Cross Machine Tests
22

3-
Kerberos can only be tested in a multi-machine environment. On localhost it always falls back to NTLM which has different requirements. Multi-machine is also neccisary for interop testing across OSs. Kerberos also requires domain controler SPN configuration so we can't test it on arbitrary test boxes.
3+
Kerberos can only be tested in a multi-machine environment. On localhost it always falls back to NTLM which has different requirements. Multi-machine is also necessary for interop testing across OSs. Kerberos also requires domain controller SPN configuration so we can't test it on arbitrary test boxes.
44

55
Test structure:
66
- A remote test server with various endpoints with different authentication restrictions.
7-
- A remote test client with endpoints that execute specific scenarios. The input for these endpoints is theory data. The output is either 200Ok, or a failure code and desciption.
7+
- A remote test client with endpoints that execute specific scenarios. The input for these endpoints is theory data. The output is either 200Ok, or a failure code and description.
88
- The CrossMachineTest class that drives the tests. It invokes the client app with the theory data and confirms the results.
99

10-
We use these three components beceause it allows us to run the tests from a dev machine or CI agent that is not part of the dedicated test domain/environment.
10+
We use these three components because it allows us to run the tests from a dev machine or CI agent that is not part of the dedicated test domain/environment.
1111

1212
(Static) Environment Setup:
1313
- Warning, this environment can take a day to set up. That's why we want a static test environment that we can re-use.
1414
- Create a Windows server running DNS and Active Directory. Promote it to a domain controller.
1515
- Create an SPN on this machine for Windows -> Windows testing. `setspn -S "http/chrross-dc.crkerberos.com" -U administrator`
1616
- Future: Can we replace the domain controller with an AAD instance? We'd still want a second windows machine for Windows -> Windows testing, but AAD might be easier to configure.
17-
- https://docs.microsoft.com/en-us/azure/active-directory-domain-services/active-directory-ds-getting-started
18-
- https://docs.microsoft.com/en-us/azure/active-directory-domain-services/active-directory-ds-join-ubuntu-linux-vm
19-
- https://docs.microsoft.com/en-us/azure/active-directory-domain-services/active-directory-ds-enable-kcd
17+
- https://docs.microsoft.com/azure/active-directory-domain-services/active-directory-ds-getting-started
18+
- https://docs.microsoft.com/azure/active-directory-domain-services/active-directory-ds-join-ubuntu-linux-vm
19+
- https://docs.microsoft.com/azure/active-directory-domain-services/active-directory-ds-enable-kcd
2020
- Create another Windows machine and join it to the test domain.
21-
- Create a Linux machine and joing it to the domain. Ubuntu 18.04 has been used in the past.
21+
- Create a Linux machine and joining it to the domain. Ubuntu 18.04 has been used in the past.
2222
- https://www.safesquid.com/content-filtering/integrating-linux-host-windows-ad-kerberos-sso-authentication
2323
- Include an HTTP SPN
2424

src/Security/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ ASP.NET Core Security
33

44
Contains the security and authorization middlewares for ASP.NET Core.
55

6-
A list of community projects related to authentication and security for ASP.NET Core are listed in the [documentation](https://docs.microsoft.com/en-us/aspnet/core/security/authentication/community).
6+
A list of community projects related to authentication and security for ASP.NET Core are listed in the [documentation](https://docs.microsoft.com/aspnet/core/security/authentication/community).
77

8-
See the [ASP.NET Core security documentation](https://docs.microsoft.com/en-us/aspnet/core/security/).
8+
See the [ASP.NET Core security documentation](https://docs.microsoft.com/aspnet/core/security/).
99

1010
### Notes
1111

src/Security/samples/Identity.ExternalClaims/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ AuthSamples.Identity.ExternalClaims
44
Sample demonstrating copying over static and dynamic external claims from Google authentication during login:
55

66
Steps:
7-
1. Configure a google OAuth2 project. See https://docs.microsoft.com/en-us/aspnet/core/security/authentication/social/google-logins?tabs=aspnetcore2x for basic setup using google logins.
7+
1. Configure a google OAuth2 project. See https://docs.microsoft.com/aspnet/core/security/authentication/social/google-logins for basic setup using google logins.
88
2. Update Startup.cs AddGoogle()'s options with ClientId and ClientSecret for your google app.
99
3. Run the app and click on the MyClaims tab, this should trigger a redirect to login.
1010
4. Login via the Google button, this should redirect you to google.

0 commit comments

Comments
 (0)