Merge pull request #2347 from elshev/patch-1

Fix syntax highlighting
pull/2359/head
Rick Anderson 2016-12-08 20:33:49 -10:00 committed by GitHub
commit 166ef3db18
2 changed files with 3 additions and 3 deletions

View File

@ -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.

View File

@ -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.