|
|
|
@ -213,84 +213,6 @@ public sealed class OpenIddictClientService |
|
|
|
throw new InvalidOperationException(SR.GetResourceString(SR.ID0140)); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Initiates an interactive user authentication demand.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="issuer">The issuer.</param>
|
|
|
|
/// <param name="scopes">The scopes to request to the authorization server.</param>
|
|
|
|
/// <param name="parameters">The additional parameters to send as part of the token request.</param>
|
|
|
|
/// <param name="properties">The application-specific properties that will be added to the authentication context.</param>
|
|
|
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
|
|
|
/// <returns>The response and a merged principal containing the claims extracted from the tokens and userinfo response.</returns>
|
|
|
|
[Obsolete("This method is obsolete and will be removed in a future version.")] |
|
|
|
public async ValueTask<(OpenIddictResponse AuthorizationResponse, OpenIddictResponse TokenResponse, ClaimsPrincipal Principal)> AuthenticateInteractivelyAsync( |
|
|
|
Uri issuer, string[]? scopes = null, |
|
|
|
Dictionary<string, OpenIddictParameter>? parameters = null, |
|
|
|
Dictionary<string, string>? properties = null, CancellationToken cancellationToken = default) |
|
|
|
{ |
|
|
|
if (issuer is null) |
|
|
|
{ |
|
|
|
throw new ArgumentNullException(nameof(issuer)); |
|
|
|
} |
|
|
|
|
|
|
|
var nonce = (await ChallengeInteractivelyAsync(new() |
|
|
|
{ |
|
|
|
AdditionalAuthorizationRequestParameters = parameters, |
|
|
|
CancellationToken = cancellationToken, |
|
|
|
Issuer = issuer, |
|
|
|
Properties = properties!, |
|
|
|
Scopes = scopes?.ToList() |
|
|
|
})).Nonce; |
|
|
|
|
|
|
|
var result = await AuthenticateInteractivelyAsync(new() |
|
|
|
{ |
|
|
|
CancellationToken = cancellationToken, |
|
|
|
Nonce = nonce, |
|
|
|
Properties = properties! |
|
|
|
}); |
|
|
|
|
|
|
|
return (result.AuthorizationResponse, result.TokenResponse, result.Principal); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Initiates an interactive user authentication demand.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="provider">The name of the provider (see <see cref="OpenIddictClientRegistration.ProviderName"/>).</param>
|
|
|
|
/// <param name="scopes">The scopes to request to the authorization server.</param>
|
|
|
|
/// <param name="parameters">The additional parameters to send as part of the token request.</param>
|
|
|
|
/// <param name="properties">The application-specific properties that will be added to the authentication context.</param>
|
|
|
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
|
|
|
/// <returns>The response and a merged principal containing the claims extracted from the tokens and userinfo response.</returns>
|
|
|
|
[Obsolete("This method is obsolete and will be removed in a future version.")] |
|
|
|
public async ValueTask<(OpenIddictResponse AuthorizationResponse, OpenIddictResponse TokenResponse, ClaimsPrincipal Principal)> AuthenticateInteractivelyAsync( |
|
|
|
string provider, string[]? scopes = null, |
|
|
|
Dictionary<string, OpenIddictParameter>? parameters = null, |
|
|
|
Dictionary<string, string>? properties = null, CancellationToken cancellationToken = default) |
|
|
|
{ |
|
|
|
if (string.IsNullOrEmpty(provider)) |
|
|
|
{ |
|
|
|
throw new ArgumentException(SR.FormatID0366(nameof(provider)), nameof(provider)); |
|
|
|
} |
|
|
|
|
|
|
|
var nonce = (await ChallengeInteractivelyAsync(new() |
|
|
|
{ |
|
|
|
AdditionalAuthorizationRequestParameters = parameters, |
|
|
|
CancellationToken = cancellationToken, |
|
|
|
Properties = properties!, |
|
|
|
ProviderName = provider, |
|
|
|
Scopes = scopes?.ToList() |
|
|
|
})).Nonce; |
|
|
|
|
|
|
|
var result = await AuthenticateInteractivelyAsync(new() |
|
|
|
{ |
|
|
|
CancellationToken = cancellationToken, |
|
|
|
Nonce = nonce, |
|
|
|
Properties = properties! |
|
|
|
}); |
|
|
|
|
|
|
|
return (result.AuthorizationResponse, result.TokenResponse, result.Principal); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Completes the interactive authentication demand corresponding to the specified nonce.
|
|
|
|
/// </summary>
|
|
|
|
@ -459,70 +381,6 @@ public sealed class OpenIddictClientService |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Authenticates using the client credentials grant.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="issuer">The issuer.</param>
|
|
|
|
/// <param name="scopes">The scopes to request to the authorization server.</param>
|
|
|
|
/// <param name="parameters">The additional parameters to send as part of the token request.</param>
|
|
|
|
/// <param name="properties">The application-specific properties that will be added to the authentication context.</param>
|
|
|
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
|
|
|
/// <returns>The response and a merged principal containing the claims extracted from the tokens and userinfo response.</returns>
|
|
|
|
[Obsolete("This method is obsolete and will be removed in a future version.")] |
|
|
|
public async ValueTask<(OpenIddictResponse Response, ClaimsPrincipal Principal)> AuthenticateWithClientCredentialsAsync( |
|
|
|
Uri issuer, string[]? scopes = null, |
|
|
|
Dictionary<string, OpenIddictParameter>? parameters = null, |
|
|
|
Dictionary<string, string>? properties = null, CancellationToken cancellationToken = default) |
|
|
|
{ |
|
|
|
if (issuer is null) |
|
|
|
{ |
|
|
|
throw new ArgumentNullException(nameof(issuer)); |
|
|
|
} |
|
|
|
|
|
|
|
var result = await AuthenticateWithClientCredentialsAsync(new() |
|
|
|
{ |
|
|
|
AdditionalTokenRequestParameters = parameters, |
|
|
|
CancellationToken = cancellationToken, |
|
|
|
Issuer = issuer, |
|
|
|
Properties = properties!, |
|
|
|
Scopes = scopes?.ToList() |
|
|
|
}); |
|
|
|
|
|
|
|
return (result.TokenResponse, result.Principal); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Authenticates using the client credentials grant.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="provider">The name of the provider (see <see cref="OpenIddictClientRegistration.ProviderName"/>).</param>
|
|
|
|
/// <param name="scopes">The scopes to request to the authorization server.</param>
|
|
|
|
/// <param name="parameters">The additional parameters to send as part of the token request.</param>
|
|
|
|
/// <param name="properties">The application-specific properties that will be added to the authentication context.</param>
|
|
|
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
|
|
|
/// <returns>The response and a merged principal containing the claims extracted from the tokens and userinfo response.</returns>
|
|
|
|
[Obsolete("This method is obsolete and will be removed in a future version.")] |
|
|
|
public async ValueTask<(OpenIddictResponse Response, ClaimsPrincipal Principal)> AuthenticateWithClientCredentialsAsync( |
|
|
|
string provider, string[]? scopes = null, |
|
|
|
Dictionary<string, OpenIddictParameter>? parameters = null, |
|
|
|
Dictionary<string, string>? properties = null, CancellationToken cancellationToken = default) |
|
|
|
{ |
|
|
|
if (string.IsNullOrEmpty(provider)) |
|
|
|
{ |
|
|
|
throw new ArgumentException(SR.FormatID0366(nameof(provider)), nameof(provider)); |
|
|
|
} |
|
|
|
|
|
|
|
var result = await AuthenticateWithClientCredentialsAsync(new() |
|
|
|
{ |
|
|
|
AdditionalTokenRequestParameters = parameters, |
|
|
|
CancellationToken = cancellationToken, |
|
|
|
Properties = properties!, |
|
|
|
ProviderName = provider, |
|
|
|
Scopes = scopes?.ToList() |
|
|
|
}); |
|
|
|
|
|
|
|
return (result.TokenResponse, result.Principal); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Authenticates using the client credentials grant.
|
|
|
|
/// </summary>
|
|
|
|
@ -615,76 +473,6 @@ public sealed class OpenIddictClientService |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Authenticates using the specified device authorization code.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="issuer">The issuer.</param>
|
|
|
|
/// <param name="code">The device authorization code returned by the server during the challenge process.</param>
|
|
|
|
/// <param name="interval">The interval at which the token requests are sent (by default, 5 seconds).</param>
|
|
|
|
/// <param name="parameters">The additional parameters to send as part of the token request.</param>
|
|
|
|
/// <param name="properties">The application-specific properties that will be added to the authentication context.</param>
|
|
|
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
|
|
|
/// <returns>The response and a merged principal containing the claims extracted from the tokens and userinfo response.</returns>
|
|
|
|
[Obsolete("This method is obsolete and will be removed in a future version.")] |
|
|
|
public async ValueTask<(OpenIddictResponse TokenResponse, ClaimsPrincipal Principal)> AuthenticateWithDeviceAsync( |
|
|
|
Uri issuer, string code, TimeSpan? interval = null, |
|
|
|
Dictionary<string, OpenIddictParameter>? parameters = null, |
|
|
|
Dictionary<string, string>? properties = null, CancellationToken cancellationToken = default) |
|
|
|
{ |
|
|
|
if (issuer is null) |
|
|
|
{ |
|
|
|
throw new ArgumentNullException(nameof(issuer)); |
|
|
|
} |
|
|
|
|
|
|
|
var result = await AuthenticateWithDeviceAsync(new() |
|
|
|
{ |
|
|
|
AdditionalTokenRequestParameters = parameters, |
|
|
|
CancellationToken = cancellationToken, |
|
|
|
DeviceCode = code, |
|
|
|
Interval = interval ?? TimeSpan.FromSeconds(5), |
|
|
|
Issuer = issuer, |
|
|
|
Properties = properties!, |
|
|
|
Timeout = TimeSpan.FromMinutes(5) |
|
|
|
}); |
|
|
|
|
|
|
|
return (result.TokenResponse, result.Principal); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Authenticates using the specified device authorization code.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="provider">The name of the provider (see <see cref="OpenIddictClientRegistration.ProviderName"/>).</param>
|
|
|
|
/// <param name="code">The device authorization code returned by the server during the challenge process.</param>
|
|
|
|
/// <param name="interval">The interval at which the token requests are sent (by default, 5 seconds).</param>
|
|
|
|
/// <param name="parameters">The additional parameters to send as part of the token request.</param>
|
|
|
|
/// <param name="properties">The application-specific properties that will be added to the authentication context.</param>
|
|
|
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
|
|
|
/// <returns>The response and a merged principal containing the claims extracted from the tokens and userinfo response.</returns>
|
|
|
|
[Obsolete("This method is obsolete and will be removed in a future version.")] |
|
|
|
public async ValueTask<(OpenIddictResponse TokenResponse, ClaimsPrincipal Principal)> AuthenticateWithDeviceAsync( |
|
|
|
string provider, string code, TimeSpan? interval = null, |
|
|
|
Dictionary<string, OpenIddictParameter>? parameters = null, |
|
|
|
Dictionary<string, string>? properties = null, CancellationToken cancellationToken = default) |
|
|
|
{ |
|
|
|
if (string.IsNullOrEmpty(provider)) |
|
|
|
{ |
|
|
|
throw new ArgumentException(SR.FormatID0366(nameof(provider)), nameof(provider)); |
|
|
|
} |
|
|
|
|
|
|
|
var result = await AuthenticateWithDeviceAsync(new() |
|
|
|
{ |
|
|
|
AdditionalTokenRequestParameters = parameters, |
|
|
|
CancellationToken = cancellationToken, |
|
|
|
DeviceCode = code, |
|
|
|
Interval = interval ?? TimeSpan.FromSeconds(5), |
|
|
|
Properties = properties!, |
|
|
|
ProviderName = provider, |
|
|
|
Timeout = TimeSpan.FromMinutes(5) |
|
|
|
}); |
|
|
|
|
|
|
|
return (result.TokenResponse, result.Principal); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Authenticates using the specified device authorization code.
|
|
|
|
/// </summary>
|
|
|
|
@ -802,76 +590,6 @@ public sealed class OpenIddictClientService |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Initiates a device authorization demand.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="issuer">The issuer.</param>
|
|
|
|
/// <param name="scopes">The scopes to request to the authorization server.</param>
|
|
|
|
/// <param name="parameters">The additional parameters to send as part of the token request.</param>
|
|
|
|
/// <param name="properties">The application-specific properties that will be added to the authentication context.</param>
|
|
|
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
|
|
|
/// <returns>The device authorization parameters.</returns>
|
|
|
|
[Obsolete("This method is obsolete and will be removed in a future version.")] |
|
|
|
public async ValueTask<(string DeviceCode, string UserCode, Uri VerificationUri, Uri? VerificationUriComplete, TimeSpan ExpiresIn, TimeSpan Interval)> ChallengeUsingDeviceAsync( |
|
|
|
Uri issuer, string[]? scopes = null, |
|
|
|
Dictionary<string, OpenIddictParameter>? parameters = null, |
|
|
|
Dictionary<string, string>? properties = null, CancellationToken cancellationToken = default) |
|
|
|
{ |
|
|
|
if (issuer is null) |
|
|
|
{ |
|
|
|
throw new ArgumentNullException(nameof(issuer)); |
|
|
|
} |
|
|
|
|
|
|
|
var result = await ChallengeUsingDeviceAsync(new() |
|
|
|
{ |
|
|
|
AdditionalDeviceAuthorizationRequestParameters = parameters, |
|
|
|
CancellationToken = cancellationToken, |
|
|
|
Issuer = issuer, |
|
|
|
Properties = properties!, |
|
|
|
Scopes = scopes?.ToList() |
|
|
|
}); |
|
|
|
|
|
|
|
return ( |
|
|
|
result.DeviceCode, result.UserCode, |
|
|
|
result.VerificationUri, result.VerificationUriComplete, |
|
|
|
result.ExpiresIn, result.Interval); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Initiates a device authorization demand.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="provider">The name of the provider (see <see cref="OpenIddictClientRegistration.ProviderName"/>).</param>
|
|
|
|
/// <param name="scopes">The scopes to request to the authorization server.</param>
|
|
|
|
/// <param name="parameters">The additional parameters to send as part of the token request.</param>
|
|
|
|
/// <param name="properties">The application-specific properties that will be added to the authentication context.</param>
|
|
|
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
|
|
|
/// <returns>The device authorization parameters.</returns>
|
|
|
|
[Obsolete("This method is obsolete and will be removed in a future version.")] |
|
|
|
public async ValueTask<(string DeviceCode, string UserCode, Uri VerificationUri, Uri? VerificationUriComplete, TimeSpan ExpiresIn, TimeSpan Interval)> ChallengeUsingDeviceAsync( |
|
|
|
string provider, string[]? scopes = null, |
|
|
|
Dictionary<string, OpenIddictParameter>? parameters = null, |
|
|
|
Dictionary<string, string>? properties = null, CancellationToken cancellationToken = default) |
|
|
|
{ |
|
|
|
if (string.IsNullOrEmpty(provider)) |
|
|
|
{ |
|
|
|
throw new ArgumentException(SR.FormatID0366(nameof(provider)), nameof(provider)); |
|
|
|
} |
|
|
|
|
|
|
|
var result = await ChallengeUsingDeviceAsync(new() |
|
|
|
{ |
|
|
|
AdditionalDeviceAuthorizationRequestParameters = parameters, |
|
|
|
CancellationToken = cancellationToken, |
|
|
|
Properties = properties!, |
|
|
|
ProviderName = provider, |
|
|
|
Scopes = scopes?.ToList() |
|
|
|
}); |
|
|
|
|
|
|
|
return ( |
|
|
|
result.DeviceCode, result.UserCode, |
|
|
|
result.VerificationUri, result.VerificationUriComplete, |
|
|
|
result.ExpiresIn, result.Interval); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Initiates a device authorization process.
|
|
|
|
/// </summary>
|
|
|
|
@ -962,78 +680,6 @@ public sealed class OpenIddictClientService |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Authenticates using the resource owner password credentials grant.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="issuer">The issuer.</param>
|
|
|
|
/// <param name="username">The username to use.</param>
|
|
|
|
/// <param name="password">The password to use.</param>
|
|
|
|
/// <param name="scopes">The scopes to request to the authorization server.</param>
|
|
|
|
/// <param name="parameters">The additional parameters to send as part of the token request.</param>
|
|
|
|
/// <param name="properties">The application-specific properties that will be added to the authentication context.</param>
|
|
|
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
|
|
|
/// <returns>The response and a merged principal containing the claims extracted from the tokens and userinfo response.</returns>
|
|
|
|
[Obsolete("This method is obsolete and will be removed in a future version.")] |
|
|
|
public async ValueTask<(OpenIddictResponse Response, ClaimsPrincipal Principal)> AuthenticateWithPasswordAsync( |
|
|
|
Uri issuer, string username, string password, string[]? scopes = null, |
|
|
|
Dictionary<string, OpenIddictParameter>? parameters = null, |
|
|
|
Dictionary<string, string>? properties = null, CancellationToken cancellationToken = default) |
|
|
|
{ |
|
|
|
if (issuer is null) |
|
|
|
{ |
|
|
|
throw new ArgumentNullException(nameof(issuer)); |
|
|
|
} |
|
|
|
|
|
|
|
var result = await AuthenticateWithPasswordAsync(new() |
|
|
|
{ |
|
|
|
AdditionalTokenRequestParameters = parameters, |
|
|
|
CancellationToken = cancellationToken, |
|
|
|
Issuer = issuer, |
|
|
|
Password = password, |
|
|
|
Properties = properties!, |
|
|
|
Scopes = scopes?.ToList(), |
|
|
|
Username = username |
|
|
|
}); |
|
|
|
|
|
|
|
return (result.TokenResponse, result.Principal); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Authenticates using the resource owner password credentials grant.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="provider">The name of the provider (see <see cref="OpenIddictClientRegistration.ProviderName"/>).</param>
|
|
|
|
/// <param name="username">The username to use.</param>
|
|
|
|
/// <param name="password">The password to use.</param>
|
|
|
|
/// <param name="scopes">The scopes to request to the authorization server.</param>
|
|
|
|
/// <param name="parameters">The additional parameters to send as part of the token request.</param>
|
|
|
|
/// <param name="properties">The application-specific properties that will be added to the authentication context.</param>
|
|
|
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
|
|
|
/// <returns>The response and a merged principal containing the claims extracted from the tokens and userinfo response.</returns>
|
|
|
|
[Obsolete("This method is obsolete and will be removed in a future version.")] |
|
|
|
public async ValueTask<(OpenIddictResponse Response, ClaimsPrincipal Principal)> AuthenticateWithPasswordAsync( |
|
|
|
string provider, string username, string password, string[]? scopes = null, |
|
|
|
Dictionary<string, OpenIddictParameter>? parameters = null, |
|
|
|
Dictionary<string, string>? properties = null, CancellationToken cancellationToken = default) |
|
|
|
{ |
|
|
|
if (string.IsNullOrEmpty(provider)) |
|
|
|
{ |
|
|
|
throw new ArgumentException(SR.FormatID0366(nameof(provider)), nameof(provider)); |
|
|
|
} |
|
|
|
|
|
|
|
var result = await AuthenticateWithPasswordAsync(new() |
|
|
|
{ |
|
|
|
AdditionalTokenRequestParameters = parameters, |
|
|
|
CancellationToken = cancellationToken, |
|
|
|
Password = password, |
|
|
|
Properties = properties!, |
|
|
|
ProviderName = provider, |
|
|
|
Scopes = scopes?.ToList(), |
|
|
|
Username = username |
|
|
|
}); |
|
|
|
|
|
|
|
return (result.TokenResponse, result.Principal); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Authenticates using the resource owner password credentials grant.
|
|
|
|
/// </summary>
|
|
|
|
@ -1127,74 +773,6 @@ public sealed class OpenIddictClientService |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Authenticates using the specified refresh token.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="issuer">The issuer.</param>
|
|
|
|
/// <param name="token">The refresh token to use.</param>
|
|
|
|
/// <param name="scopes">The scopes to request to the authorization server.</param>
|
|
|
|
/// <param name="parameters">The additional parameters to send as part of the token request.</param>
|
|
|
|
/// <param name="properties">The application-specific properties that will be added to the authentication context.</param>
|
|
|
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
|
|
|
/// <returns>The response and a merged principal containing the claims extracted from the tokens and userinfo response.</returns>
|
|
|
|
[Obsolete("This method is obsolete and will be removed in a future version.")] |
|
|
|
public async ValueTask<(OpenIddictResponse Response, ClaimsPrincipal Principal)> AuthenticateWithRefreshTokenAsync( |
|
|
|
Uri issuer, string token, string[]? scopes = null, |
|
|
|
Dictionary<string, OpenIddictParameter>? parameters = null, |
|
|
|
Dictionary<string, string>? properties = null, CancellationToken cancellationToken = default) |
|
|
|
{ |
|
|
|
if (issuer is null) |
|
|
|
{ |
|
|
|
throw new ArgumentNullException(nameof(issuer)); |
|
|
|
} |
|
|
|
|
|
|
|
var result = await AuthenticateWithRefreshTokenAsync(new() |
|
|
|
{ |
|
|
|
AdditionalTokenRequestParameters = parameters, |
|
|
|
CancellationToken = cancellationToken, |
|
|
|
Issuer = issuer, |
|
|
|
Properties = properties!, |
|
|
|
RefreshToken = token, |
|
|
|
Scopes = scopes?.ToList() |
|
|
|
}); |
|
|
|
|
|
|
|
return (result.TokenResponse, result.Principal); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Authenticates using the specified refresh token.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="provider">The name of the provider (see <see cref="OpenIddictClientRegistration.ProviderName"/>).</param>
|
|
|
|
/// <param name="token">The refresh token to use.</param>
|
|
|
|
/// <param name="scopes">The scopes to request to the authorization server.</param>
|
|
|
|
/// <param name="parameters">The additional parameters to send as part of the token request.</param>
|
|
|
|
/// <param name="properties">The application-specific properties that will be added to the authentication context.</param>
|
|
|
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
|
|
|
|
/// <returns>The response and a merged principal containing the claims extracted from the tokens and userinfo response.</returns>
|
|
|
|
[Obsolete("This method is obsolete and will be removed in a future version.")] |
|
|
|
public async ValueTask<(OpenIddictResponse Response, ClaimsPrincipal Principal)> AuthenticateWithRefreshTokenAsync( |
|
|
|
string provider, string token, string[]? scopes = null, |
|
|
|
Dictionary<string, OpenIddictParameter>? parameters = null, |
|
|
|
Dictionary<string, string>? properties = null, CancellationToken cancellationToken = default) |
|
|
|
{ |
|
|
|
if (string.IsNullOrEmpty(provider)) |
|
|
|
{ |
|
|
|
throw new ArgumentException(SR.FormatID0366(nameof(provider)), nameof(provider)); |
|
|
|
} |
|
|
|
|
|
|
|
var result = await AuthenticateWithRefreshTokenAsync(new() |
|
|
|
{ |
|
|
|
AdditionalTokenRequestParameters = parameters, |
|
|
|
CancellationToken = cancellationToken, |
|
|
|
Properties = properties!, |
|
|
|
ProviderName = provider, |
|
|
|
RefreshToken = token, |
|
|
|
Scopes = scopes?.ToList() |
|
|
|
}); |
|
|
|
|
|
|
|
return (result.TokenResponse, result.Principal); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Authenticates using the specified refresh token.
|
|
|
|
/// </summary>
|
|
|
|
|