|
|
|
@ -423,26 +423,34 @@ public static partial class OpenIddictClientHandlers |
|
|
|
throw new InvalidOperationException(SR.GetResourceString(SR.ID0408)); |
|
|
|
} |
|
|
|
|
|
|
|
try |
|
|
|
// Resolve and attach the server configuration to the context if none has been set already.
|
|
|
|
if (context.Configuration is null) |
|
|
|
{ |
|
|
|
// Resolve and attach the server configuration to the context if none has been set already.
|
|
|
|
context.Configuration ??= await context.Registration.ConfigurationManager |
|
|
|
.GetConfigurationAsync(context.CancellationToken) |
|
|
|
.WaitAsync(context.CancellationToken) ?? |
|
|
|
throw new InvalidOperationException(SR.GetResourceString(SR.ID0140)); |
|
|
|
} |
|
|
|
if (context.Registration.ConfigurationManager is null) |
|
|
|
{ |
|
|
|
throw new InvalidOperationException(SR.GetResourceString(SR.ID0422)); |
|
|
|
} |
|
|
|
|
|
|
|
catch (Exception exception) when (!OpenIddictHelpers.IsFatal(exception) && |
|
|
|
exception is not OperationCanceledException) |
|
|
|
{ |
|
|
|
context.Logger.LogError(exception, SR.GetResourceString(SR.ID6219)); |
|
|
|
try |
|
|
|
{ |
|
|
|
context.Configuration = await context.Registration.ConfigurationManager |
|
|
|
.GetConfigurationAsync(context.CancellationToken) |
|
|
|
.WaitAsync(context.CancellationToken) ?? |
|
|
|
throw new InvalidOperationException(SR.GetResourceString(SR.ID0140)); |
|
|
|
} |
|
|
|
|
|
|
|
context.Reject( |
|
|
|
error: Errors.ServerError, |
|
|
|
description: SR.GetResourceString(SR.ID2170), |
|
|
|
uri: SR.FormatID8000(SR.ID2170)); |
|
|
|
catch (Exception exception) when (!OpenIddictHelpers.IsFatal(exception) && |
|
|
|
exception is not OperationCanceledException) |
|
|
|
{ |
|
|
|
context.Logger.LogError(exception, SR.GetResourceString(SR.ID6219)); |
|
|
|
|
|
|
|
return; |
|
|
|
context.Reject( |
|
|
|
error: Errors.ServerError, |
|
|
|
description: SR.GetResourceString(SR.ID2170), |
|
|
|
uri: SR.FormatID8000(SR.ID2170)); |
|
|
|
|
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// Ensure the selected grant type, if explicitly set, is listed as supported in the configuration.
|
|
|
|
@ -1019,28 +1027,37 @@ public static partial class OpenIddictClientHandlers |
|
|
|
// Note: if the static registration cannot be found in the options, this may indicate
|
|
|
|
// the client was removed after the authorization dance started and thus, can no longer
|
|
|
|
// be used to authenticate users. In this case, throw an exception to abort the flow.
|
|
|
|
context.Registration = await _service.GetClientRegistrationByIdAsync(context.RegistrationId, context.CancellationToken); |
|
|
|
context.Registration ??= await _service.GetClientRegistrationByIdAsync(context.RegistrationId, context.CancellationToken); |
|
|
|
|
|
|
|
try |
|
|
|
// Resolve and attach the server configuration to the context if none has been set already.
|
|
|
|
if (context.Configuration is null) |
|
|
|
{ |
|
|
|
// Resolve and attach the server configuration to the context.
|
|
|
|
context.Configuration = await context.Registration.ConfigurationManager |
|
|
|
.GetConfigurationAsync(context.CancellationToken) |
|
|
|
.WaitAsync(context.CancellationToken) ?? |
|
|
|
throw new InvalidOperationException(SR.GetResourceString(SR.ID0140)); |
|
|
|
} |
|
|
|
if (context.Registration.ConfigurationManager is null) |
|
|
|
{ |
|
|
|
throw new InvalidOperationException(SR.GetResourceString(SR.ID0422)); |
|
|
|
} |
|
|
|
|
|
|
|
catch (Exception exception) when (!OpenIddictHelpers.IsFatal(exception) && |
|
|
|
exception is not OperationCanceledException) |
|
|
|
{ |
|
|
|
context.Logger.LogError(exception, SR.GetResourceString(SR.ID6219)); |
|
|
|
try |
|
|
|
{ |
|
|
|
// Resolve and attach the server configuration to the context.
|
|
|
|
context.Configuration = await context.Registration.ConfigurationManager |
|
|
|
.GetConfigurationAsync(context.CancellationToken) |
|
|
|
.WaitAsync(context.CancellationToken) ?? |
|
|
|
throw new InvalidOperationException(SR.GetResourceString(SR.ID0140)); |
|
|
|
} |
|
|
|
|
|
|
|
context.Reject( |
|
|
|
error: Errors.ServerError, |
|
|
|
description: SR.GetResourceString(SR.ID2170), |
|
|
|
uri: SR.FormatID8000(SR.ID2170)); |
|
|
|
catch (Exception exception) when (!OpenIddictHelpers.IsFatal(exception) && |
|
|
|
exception is not OperationCanceledException) |
|
|
|
{ |
|
|
|
context.Logger.LogError(exception, SR.GetResourceString(SR.ID6219)); |
|
|
|
|
|
|
|
return; |
|
|
|
context.Reject( |
|
|
|
error: Errors.ServerError, |
|
|
|
description: SR.GetResourceString(SR.ID2170), |
|
|
|
uri: SR.FormatID8000(SR.ID2170)); |
|
|
|
|
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
@ -4209,26 +4226,34 @@ public static partial class OpenIddictClientHandlers |
|
|
|
throw new InvalidOperationException(SR.GetResourceString(SR.ID0408)); |
|
|
|
} |
|
|
|
|
|
|
|
try |
|
|
|
// Resolve and attach the server configuration to the context if none has been set already.
|
|
|
|
if (context.Configuration is null) |
|
|
|
{ |
|
|
|
// Resolve and attach the server configuration to the context if none has been set already.
|
|
|
|
context.Configuration ??= await context.Registration.ConfigurationManager |
|
|
|
.GetConfigurationAsync(context.CancellationToken) |
|
|
|
.WaitAsync(context.CancellationToken) ?? |
|
|
|
throw new InvalidOperationException(SR.GetResourceString(SR.ID0140)); |
|
|
|
} |
|
|
|
if (context.Registration.ConfigurationManager is null) |
|
|
|
{ |
|
|
|
throw new InvalidOperationException(SR.GetResourceString(SR.ID0422)); |
|
|
|
} |
|
|
|
|
|
|
|
catch (Exception exception) when (!OpenIddictHelpers.IsFatal(exception) && |
|
|
|
exception is not OperationCanceledException) |
|
|
|
{ |
|
|
|
context.Logger.LogError(exception, SR.GetResourceString(SR.ID6219)); |
|
|
|
try |
|
|
|
{ |
|
|
|
context.Configuration = await context.Registration.ConfigurationManager |
|
|
|
.GetConfigurationAsync(context.CancellationToken) |
|
|
|
.WaitAsync(context.CancellationToken) ?? |
|
|
|
throw new InvalidOperationException(SR.GetResourceString(SR.ID0140)); |
|
|
|
} |
|
|
|
|
|
|
|
context.Reject( |
|
|
|
error: Errors.ServerError, |
|
|
|
description: SR.GetResourceString(SR.ID2170), |
|
|
|
uri: SR.FormatID8000(SR.ID2170)); |
|
|
|
catch (Exception exception) when (!OpenIddictHelpers.IsFatal(exception) && |
|
|
|
exception is not OperationCanceledException) |
|
|
|
{ |
|
|
|
context.Logger.LogError(exception, SR.GetResourceString(SR.ID6219)); |
|
|
|
|
|
|
|
return; |
|
|
|
context.Reject( |
|
|
|
error: Errors.ServerError, |
|
|
|
description: SR.GetResourceString(SR.ID2170), |
|
|
|
uri: SR.FormatID8000(SR.ID2170)); |
|
|
|
|
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
@ -5852,26 +5877,34 @@ public static partial class OpenIddictClientHandlers |
|
|
|
throw new InvalidOperationException(SR.GetResourceString(SR.ID0408)); |
|
|
|
} |
|
|
|
|
|
|
|
try |
|
|
|
// Resolve and attach the server configuration to the context if none has been set already.
|
|
|
|
if (context.Configuration is null) |
|
|
|
{ |
|
|
|
// Resolve and attach the server configuration to the context if none has been set already.
|
|
|
|
context.Configuration ??= await context.Registration.ConfigurationManager |
|
|
|
.GetConfigurationAsync(context.CancellationToken) |
|
|
|
.WaitAsync(context.CancellationToken) ?? |
|
|
|
throw new InvalidOperationException(SR.GetResourceString(SR.ID0140)); |
|
|
|
} |
|
|
|
if (context.Registration.ConfigurationManager is null) |
|
|
|
{ |
|
|
|
throw new InvalidOperationException(SR.GetResourceString(SR.ID0422)); |
|
|
|
} |
|
|
|
|
|
|
|
catch (Exception exception) when (!OpenIddictHelpers.IsFatal(exception) && |
|
|
|
exception is not OperationCanceledException) |
|
|
|
{ |
|
|
|
context.Logger.LogError(exception, SR.GetResourceString(SR.ID6219)); |
|
|
|
try |
|
|
|
{ |
|
|
|
context.Configuration = await context.Registration.ConfigurationManager |
|
|
|
.GetConfigurationAsync(context.CancellationToken) |
|
|
|
.WaitAsync(context.CancellationToken) ?? |
|
|
|
throw new InvalidOperationException(SR.GetResourceString(SR.ID0140)); |
|
|
|
} |
|
|
|
|
|
|
|
context.Reject( |
|
|
|
error: Errors.ServerError, |
|
|
|
description: SR.GetResourceString(SR.ID2170), |
|
|
|
uri: SR.FormatID8000(SR.ID2170)); |
|
|
|
catch (Exception exception) when (!OpenIddictHelpers.IsFatal(exception) && |
|
|
|
exception is not OperationCanceledException) |
|
|
|
{ |
|
|
|
context.Logger.LogError(exception, SR.GetResourceString(SR.ID6219)); |
|
|
|
|
|
|
|
return; |
|
|
|
context.Reject( |
|
|
|
error: Errors.ServerError, |
|
|
|
description: SR.GetResourceString(SR.ID2170), |
|
|
|
uri: SR.FormatID8000(SR.ID2170)); |
|
|
|
|
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|