Class ExternalAuthenticationProvider
Authentication Provider that relies on an external token provider
Inherited Members
Namespace: PnP.Core.Auth
Assembly: PnP.Core.Auth.dll
Syntax
public sealed class ExternalAuthenticationProvider : OAuthAuthenticationProvider, IAuthenticationProvider
Constructors
ExternalAuthenticationProvider(Func<Uri, String[], String>)
Public constructor for external consumers of the library
Declaration
public ExternalAuthenticationProvider(Func<Uri, string[], string> accessTokenProvider)
Parameters
Func<Uri, System.String[], System.String>
accessTokenProvider
A function providing the access token to use |
ExternalAuthenticationProvider(Func<Uri, String[], Task<String>>)
Public constructor for external consumers of the library
Declaration
public ExternalAuthenticationProvider(Func<Uri, string[], Task<string>> accessTokenProvider)
Parameters
Func<Uri, System.String[], Task<System.String>>
accessTokenProvider
A function providing the access token to use |
ExternalAuthenticationProvider(ILogger<OAuthAuthenticationProvider>)
Public constructor leveraging DI to initialize the ILogger interfafce
Declaration
public ExternalAuthenticationProvider(ILogger<OAuthAuthenticationProvider> logger)
Parameters
ILogger<OAuthAuthenticationProvider>
logger
The instance of the logger service provided by DI |
Properties
AccessTokenProvider
A function providing the access token to use
Declaration
public Func<Uri, string[], string> AccessTokenProvider { get; set; }
Property Value
Func<Uri, System.String[], System.String>
|
AccessTokenTaskProvider
A function providing the access token to use
Declaration
public Func<Uri, string[], Task<string>> AccessTokenTaskProvider { get; set; }
Property Value
Func<Uri, System.String[], Task<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 |
Returns
Task
The task to await. |
Overrides
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
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 |
System.String[]
scopes
Scopes to request |
Returns
Task<System.String>
An access token |