Search Results for

    Show / Hide Table of Contents

    Class UsernamePasswordAuthenticationProvider

    Authentication Provider that uses a Resource Owner Password Credentials (ROCP) credential flow

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

    You can find further details about ROPC here: https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth-ropc

    Constructors

    UsernamePasswordAuthenticationProvider(ILogger<OAuthAuthenticationProvider>, IMsalHttpClientFactory)

    Public constructor leveraging DI to initialize the ILogger and IMsalHttpClientFactory interfaces

    Declaration
    public UsernamePasswordAuthenticationProvider(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

    UsernamePasswordAuthenticationProvider(String, String, PnPCoreAuthenticationUsernamePasswordOptions)

    Public constructor for external consumers of the library

    Declaration
    public UsernamePasswordAuthenticationProvider(string clientId, string tenantId, PnPCoreAuthenticationUsernamePasswordOptions options)
    Parameters
    System.String clientId

    The Client ID for the Authentication Provider

    System.String tenantId

    The Tenant ID for the Authentication Provider

    PnPCoreAuthenticationUsernamePasswordOptions options

    Options for the authentication provider

    UsernamePasswordAuthenticationProvider(String, String, String, SecureString)

    Public constructor for external consumers of the library

    Declaration
    public UsernamePasswordAuthenticationProvider(string clientId, string tenantId, string username, SecureString password)
    Parameters
    System.String clientId

    The Client ID for the Authentication Provider

    System.String tenantId

    The Tenant ID for the Authentication Provider

    System.String username

    The Username for authentication

    SecureString password

    The Password for authentication

    Properties

    Password

    The password for authenticating

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

    Username

    The username for authenticating

    Declaration
    public string Username { get; set; }
    Property Value
    System.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<System.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)

    System.String[] scopes

    Scopes to request

    Returns
    Task<System.String>

    An access token

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