-
Notifications
You must be signed in to change notification settings - Fork 1
OAuth2Settings
Provides details of the endpoints and settings neccesary to authentication with an OAuth 2.0 protected service. Instances of this class are passed to the OAuth2RequestSigningHandler to control how access tokens are obtained and refreshed, as well as to provide an existing token to use if available.
OAuth2Token AccessToken
Sets or returns an existing OAuth2Token instance that will be used to sign requests until it expires, at which point a new token will be requested. If you have long lived tokens you are persisting and reusing between app sessions, set this to the deserialised token previously acquired. It will be used until it expires, and then a new token will be requested automatically.
The end point accessed to retrieve an authorisation code. Only required by authentication flows that use authorisation codes.
The end point accessed to retrieve or refresh an access token.
The redirect url to be provided to the service during authentication flows.
ICredentialProvider ClientCredentialProvider
A reference to an ICredentialProvider implementation that is used to retreive the client id and secret when neccesary.
The type of grant being requested. The default value is OAuth2GrantTypes.AuthorizationCode. The exact value depends on the authentication flow being used, but common types are provided by OAuth2GrantTypes.
The scope of access requested. This is typically equivalent to a set of 'permissions' requested. These are service specific, so check with the documentation for the service you are connecting to.
A function that returns an opaque value used by the client to maintain state between the request and callback. The authorization server includes this value when redirecting the user-agent back to the client.
An optional factory used to create instances used for conducting OAuth 2 related HTTP calls. If null, the library will create it's own instance internally.
OAuth2HttpRequestSigningMethod RequestSigningMethod
Sets or returns a value indicating how requests to the API are signed. The default and recommended value is OAuth2HttpRequestSigningMethod.AuthorizationHeader. Change this setting to a non-default value only if required by the OAuth 2.0 API.
Only used if RequestSigningMethod is OAuth2HttpRequestSigningMethod.UrlQuery. Specifies the key to use in the url query string for the access token. The default is access_token.
Provides a dictionary of OAuth .Net types that represent token types this client supports. By default contains both Bearer and Token referencing the OAuth2Token type.
A function called when the GrantType property is OAuth2GrantTypes.AuthorizationCode and the user is required to authenticate. Must return an awaitable System.Threading.Task<AuthorisationCodeResponse> which is the result of of a successful authentication returning an auth code response, otherwise should throw an exception.
Checks the current setttings and throws an InvalidOperationException with a descriptive error message if any problems are found.