DataProtectionCommonExtensions.GetDataProtector Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
GetDataProtector(IServiceProvider, IEnumerable<String>) |
Retrieves an IDataProtector from an IServiceProvider given a list of purposes. |
GetDataProtector(IServiceProvider, String, String[]) |
Retrieves an IDataProtector from an IServiceProvider given a list of purposes. |
GetDataProtector(IServiceProvider, IEnumerable<String>)
Retrieves an IDataProtector from an IServiceProvider given a list of purposes.
public:
[System::Runtime::CompilerServices::Extension]
static Microsoft::AspNetCore::DataProtection::IDataProtector ^ GetDataProtector(IServiceProvider ^ services, System::Collections::Generic::IEnumerable<System::String ^> ^ purposes);
public static Microsoft.AspNetCore.DataProtection.IDataProtector GetDataProtector (this IServiceProvider services, System.Collections.Generic.IEnumerable<string> purposes);
static member GetDataProtector : IServiceProvider * seq<string> -> Microsoft.AspNetCore.DataProtection.IDataProtector
<Extension()>
Public Function GetDataProtector (services As IServiceProvider, purposes As IEnumerable(Of String)) As IDataProtector
Parameters
- services
- IServiceProvider
An IServiceProvider which contains the IDataProtectionProvider from which to generate the purpose chain.
- purposes
- IEnumerable<String>
The list of purposes which contribute to the purpose chain. This list must contain at least one element, and it may not contain null elements.
Returns
An IDataProtector tied to the provided purpose chain.
Remarks
This is a convenience method which calls GetDataProtectionProvider(IServiceProvider) then CreateProtector(IDataProtectionProvider, IEnumerable<String>). See those methods' documentation for more information.
Applies to
GetDataProtector(IServiceProvider, String, String[])
Retrieves an IDataProtector from an IServiceProvider given a list of purposes.
public:
[System::Runtime::CompilerServices::Extension]
static Microsoft::AspNetCore::DataProtection::IDataProtector ^ GetDataProtector(IServiceProvider ^ services, System::String ^ purpose, ... cli::array <System::String ^> ^ subPurposes);
public static Microsoft.AspNetCore.DataProtection.IDataProtector GetDataProtector (this IServiceProvider services, string purpose, params string[] subPurposes);
static member GetDataProtector : IServiceProvider * string * string[] -> Microsoft.AspNetCore.DataProtection.IDataProtector
<Extension()>
Public Function GetDataProtector (services As IServiceProvider, purpose As String, ParamArray subPurposes As String()) As IDataProtector
Parameters
- services
- IServiceProvider
An IServiceProvider which contains the IDataProtectionProvider from which to generate the purpose chain.
- purpose
- String
The primary purpose used to create the IDataProtector.
- subPurposes
- String[]
An optional list of secondary purposes which contribute to the purpose chain. If this list is provided it cannot contain null elements.
Returns
An IDataProtector tied to the provided purpose chain.
Remarks
This is a convenience method which calls GetDataProtectionProvider(IServiceProvider) then CreateProtector(IDataProtectionProvider, String, String[]). See those methods' documentation for more information.