Search Results for

    Show / Hide Table of Contents

    Class OnBehalfOfAuthenticationProvider

    Authentication Provider based on the OnBehalfOf flow

    Inheritance
    Object
    OAuthAuthenticationProvider
    OnBehalfOfAuthenticationProvider
    Inherited Members
    OAuthAuthenticationProvider.ConfigurationName
    OAuthAuthenticationProvider.ClientId
    OAuthAuthenticationProvider.TenantId
    OAuthAuthenticationProvider.DefaultAADAppId
    Namespace: PnP.Core.Auth
    Assembly: PnP.Core.Auth.dll
    Syntax
    public sealed class OnBehalfOfAuthenticationProvider : OAuthAuthenticationProvider, IAuthenticationProvider
    Remarks

    You can find further details about the On-Behalf-Of flow here: https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-on-behalf-of-flow

    Constructors

    OnBehalfOfAuthenticationProvider(ILogger<OAuthAuthenticationProvider>, IMsalHttpClientFactory)

    Public constructor leveraging DI to initialize the ILogger and IMsalHttpClientFactory interfaces

    Declaration
    public OnBehalfOfAuthenticationProvider(ILogger<OAuthAuthenticationProvider> logger, IMsalHttpClientFactory msalHttpClientFactory)
    Parameters
    ILogger<OAuthAuthenticationProvider> logger

    The instance of the logger service provided by DI

    IMsalHttpClientFactory msalHttpClientFactory

    The instance of the Msal Http Client Factory service provided by DI

    OnBehalfOfAuthenticationProvider(String, String, PnPCoreAuthenticationOnBehalfOfOptions, Func<String>)

    Public constructor for external consumers of the library

    Declaration
    public OnBehalfOfAuthenticationProvider(string clientId, string tenantId, PnPCoreAuthenticationOnBehalfOfOptions options, Func<string> userTokenProvider)
    Parameters
    String clientId

    The Client ID for the Authentication Provider

    String tenantId

    The Tenant ID for the Authentication Provider

    PnPCoreAuthenticationOnBehalfOfOptions options

    Options for the authentication provider

    Func<String> userTokenProvider

    A function providing the consumer user access token to use for the On-Behalf-Of flow

    OnBehalfOfAuthenticationProvider(String, String, SecureString, Func<String>)

    Public constructor for external consumers of the library

    Declaration
    public OnBehalfOfAuthenticationProvider(string clientId, string tenantId, SecureString clientSecret, Func<string> userTokenProvider)
    Parameters
    String clientId

    The Client ID for the Authentication Provider

    String tenantId

    The Tenant ID for the Authentication Provider

    SecureString clientSecret

    The Client Secret of the app

    Func<String> userTokenProvider

    A function providing the consumer user access token to use for the On-Behalf-Of flow

    OnBehalfOfAuthenticationProvider(String, String, StoreName, StoreLocation, String, Func<String>)

    Public constructor for external consumers of the library

    Declaration
    public OnBehalfOfAuthenticationProvider(string clientId, string tenantId, StoreName storeName, StoreLocation storeLocation, string thumbprint, Func<string> userTokenProvider)
    Parameters
    String clientId

    The Client ID for the Authentication Provider

    String tenantId

    The Tenant ID for the Authentication Provider

    StoreName storeName

    The Store Name to get the X.509 certificate from

    StoreLocation storeLocation

    The Store Location to get the X.509 certificate from

    String thumbprint

    The Thumbprint of the X.509 certificate

    Func<String> userTokenProvider

    A function providing the consumer user access token to use for the On-Behalf-Of flow

    OnBehalfOfAuthenticationProvider(String, String, X509Certificate2, Func<String>)

    Public constructor for external consumers of the library

    Declaration
    public OnBehalfOfAuthenticationProvider(string clientId, string tenantId, X509Certificate2 certificate, Func<string> userTokenProvider)
    Parameters
    String clientId

    The Client ID for the Authentication Provider

    String tenantId

    The Tenant ID for the Authentication Provider

    X509Certificate2 certificate

    The X.509 certificate to use for authentication

    Func<String> userTokenProvider

    A function providing the consumer user access token to use for the On-Behalf-Of flow

    Properties

    Certificate

    The X.509 Certificate to use for app authentication

    Declaration
    public X509Certificate2 Certificate { get; set; }
    Property Value
    X509Certificate2

    ClientSecret

    The ClientSecret to authenticate the app with ClientId

    Declaration
    public SecureString ClientSecret { get; set; }
    Property Value
    SecureString

    UserTokenProvider

    A function providing the consumer user access token to use for the On-Behalf-Of flow

    Declaration
    public Func<string> UserTokenProvider { get; set; }
    Property Value
    Func<String>

    Methods

    AuthenticateRequestAsync(Uri, HttpRequestMessage)

    Authenticates the specified request message.

    Declaration
    public override async Task AuthenticateRequestAsync(Uri resource, HttpRequestMessage request)
    Parameters
    Uri resource

    Request uri

    HttpRequestMessage request

    The to authenticate.

    Returns
    Task

    The task to await.

    Overrides
    OAuthAuthenticationProvider.AuthenticateRequestAsync(Uri, HttpRequestMessage)

    GetAccessTokenAsync(Uri)

    Gets an access token for the requested resource

    Declaration
    public override async Task<string> GetAccessTokenAsync(Uri resource)
    Parameters
    Uri resource

    Resource to request an access token for

    Returns
    Task<String>

    An access token

    Overrides
    OAuthAuthenticationProvider.GetAccessTokenAsync(Uri)

    GetAccessTokenAsync(Uri, String[])

    Gets an access token for the requested resource and scope

    Declaration
    public override async Task<string> GetAccessTokenAsync(Uri resource, string[] scopes)
    Parameters
    Uri resource

    Resource to request an access token for (unused)

    String[] scopes

    Scopes to request

    Returns
    Task<String>

    An access token

    Overrides
    OAuthAuthenticationProvider.GetAccessTokenAsync(Uri, String[])
    Back to top PnP Core SDK
    Generated by DocFX with Material UI
    spacer