From 933caa1b2d16257ea0cf8cec3ddc30e5a5d8e5f3 Mon Sep 17 00:00:00 2001 From: elshev Date: Thu, 8 Dec 2016 09:00:40 +0300 Subject: [PATCH 1/2] Fix syntax highlighting --- aspnetcore/security/data-protection/consumer-apis/overview.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/aspnetcore/security/data-protection/consumer-apis/overview.md b/aspnetcore/security/data-protection/consumer-apis/overview.md index 6aa99bb14e..959179a147 100644 --- a/aspnetcore/security/data-protection/consumer-apis/overview.md +++ b/aspnetcore/security/data-protection/consumer-apis/overview.md @@ -45,11 +45,11 @@ The following sample demonstrates three concepts: 3. Creating an IDataProtector from an IDataProtectionProvider and using it to protect and unprotect data. -[!code-none[Main](../using-data-protection/samples/protectunprotect.cs?highlight=26,34,35,36,37,38,39,40)] +[!code-csharp[Main](../using-data-protection/samples/protectunprotect.cs?highlight=26,34,35,36,37,38,39,40)] The package Microsoft.AspNetCore.DataProtection.Abstractions contains an extension method IServiceProvider.GetDataProtector as a developer convenience. It encapsulates as a single operation both retrieving an IDataProtectionProvider from the service provider and calling IDataProtectionProvider.CreateProtector. The following sample demonstrates its usage. -[!code-none[Main](./overview/samples/getdataprotector.cs?highlight=15)] +[!code-csharp[Main](./overview/samples/getdataprotector.cs?highlight=15)] >[!TIP] > Instances of IDataProtectionProvider and IDataProtector are thread-safe for multiple callers. It is intended that once a component gets a reference to an IDataProtector via a call to CreateProtector, it will use that reference for multiple calls to Protect and Unprotect.A call to Unprotect will throw CryptographicException if the protected payload cannot be verified or deciphered. Some components may wish to ignore errors during unprotect operations; a component which reads authentication cookies might handle this error and treat the request as if it had no cookie at all rather than fail the request outright. Components which want this behavior should specifically catch CryptographicException instead of swallowing all exceptions. From f862bba6a4000f63977688da2b3b6d4e7f3c29e4 Mon Sep 17 00:00:00 2001 From: elshev Date: Thu, 8 Dec 2016 09:14:18 +0300 Subject: [PATCH 2/2] Update password-hashing.md --- .../security/data-protection/consumer-apis/password-hashing.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aspnetcore/security/data-protection/consumer-apis/password-hashing.md b/aspnetcore/security/data-protection/consumer-apis/password-hashing.md index c378a1321e..602d49934b 100644 --- a/aspnetcore/security/data-protection/consumer-apis/password-hashing.md +++ b/aspnetcore/security/data-protection/consumer-apis/password-hashing.md @@ -24,6 +24,6 @@ The package currently offers a method `KeyDerivation.Pbkdf2` which allows hashin 3. The `KeyDerivation.Pbkdf2` method requires the caller to specify all parameters (salt, PRF, and iteration count). The `Rfc2898DeriveBytes` type provides default values for these. -[!code-none[Main](password-hashing/samples/passwordhasher.cs)] +[!code-csharp[Main](password-hashing/samples/passwordhasher.cs)] See the source code for ASP.NET Core Identity's `PasswordHasher` type for a real-world use case.