-
Notifications
You must be signed in to change notification settings - Fork 0
Services IAuthorizationCodeFailureNotifier
The Authorization Code Failure Notifier handles failures that occur when requesting an authorization code and exposes those failures to application code through an event.
This service is meant for surfacing failures, for example by displaying an error to the user, logging, or triggering telemetry. It does not attempt to retry, recover, or translate the failure into a different model.
- Accept an authorization code failure result.
- Notify subscribers that an authorization code request has failed.
- Provide an overridable hook for customizing how failure notifications are raised.
-
Failed: Occurs when an authorization code request fails. -
HandleFailureAsync: When called, handles the specified authorization code failure result.
The default implementation is AuthorizationCodeFailureNotifier.
It implements the Failed event using an internal event handler field and raises the event whenever HandleFailureAsync is called. The method returns Task.CompletedTask after raising the event.
A protected virtual OnFailed method is used to raise the event. Deriving from the default implementation and overriding OnFailed is the intended customization point if you need additional behavior, such as logging or telemetry, before or after notifying subscribers.
- Subscribe to
Failedto be notified when an authorization code request does not succeed. - The event provides failure details through the
AuthorizationCodeResultargument.
- Call
HandleFailureAsyncwith theAuthorizationCodeResultthat represents the failure.
- The default implementation does not queue or persist failures. If there are no subscribers when the event is raised, the failure is effectively ignored.
- Event handlers that throw exceptions will cause those exceptions to propagate from the event invocation. If you want isolation, override
OnFailedand wrap invocation in exception handling. -
HandleFailureAsyncdoes not perform asynchronous work in the default implementation. If you need awaited processing, implement your own notifier or schedule asynchronous work from an overriddenOnFailed.