-
Notifications
You must be signed in to change notification settings - Fork 379
Add extensibility APIs #5573
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Add extensibility APIs #5573
Changes from all commits
3c32188
2ea7e48
dac7c01
303d8f2
17765a0
9270a68
9d28ea3
c7363e0
ef00c82
1f5b23a
463eb4e
107548e
037e52e
1a6b296
9fb9dc7
e8f7137
198de3f
20ce7bc
745f44c
589a614
6d303a9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -131,6 +131,26 @@ public string ClientVersion | |
| internal IRetryPolicyFactory RetryPolicyFactory { get; set; } | ||
| internal ICsrFactory CsrFactory { get; set; } | ||
|
|
||
| #region Extensibility Callbacks | ||
|
|
||
| /// <summary> | ||
| /// Dynamic certificate provider callback for client credential flows. | ||
| /// </summary> | ||
| public Func<AssertionRequestOptions, Task<X509Certificate2>> ClientCredentialCertificateProvider { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// MSAL service failure callback that determines whether to retry after a token acquisition failure from the identity provider. | ||
| /// Only invoked for MsalServiceException (errors from the Security Token Service). | ||
| /// </summary> | ||
| public Func<AssertionRequestOptions, MsalException, Task<bool>> OnMsalServiceFailureCallback { get; set; } | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. naming: I believe the convention for these callbacks is to not use the "callback" suffix. So maybe "OnBeforeMsalServiceException"
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Or OnMsalServiceExceptionProvider? |
||
|
|
||
| /// <summary> | ||
| /// Success callback that receives the result of token acquisition attempts (typically successful, but can include failures after retries are exhausted). | ||
| /// </summary> | ||
| public Func<AssertionRequestOptions, ExecutionResult, Task> OnSuccessCallback { get; set; } | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need this ExecutionResult object? It seems to me that OnMsalServiceFailure takes care of the error sceanrio. And so this can be
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, the OnMsalServiceFailure wll only handle the exceptions defined in the callback. There can be other exceptions as well that can be thrown. |
||
|
|
||
| #endregion | ||
|
|
||
| #region ClientCredentials | ||
|
|
||
| // Indicates if claims or assertions are used within the configuration | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| namespace Microsoft.Identity.Client.Extensibility | ||
| { | ||
| /// <summary> | ||
| /// Represents the result of a token acquisition attempt. | ||
| /// Used by the execution observer configured via <see cref="ConfidentialClientApplicationBuilderExtensions.OnSuccess"/>. | ||
| /// </summary> | ||
| public class ExecutionResult | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can this include the credential used (primarily care about the exact certificate used). If that information is in AuthenticationResult then that is fine. |
||
| { | ||
| /// <summary> | ||
| /// Internal constructor for ExecutionResult. | ||
| /// </summary> | ||
| internal ExecutionResult() { } | ||
|
|
||
| /// <summary> | ||
| /// Indicates whether the token acquisition was successful. | ||
| /// </summary> | ||
| /// <value> | ||
| /// <c>true</c> if the token was successfully acquired; otherwise, <c>false</c>. | ||
| /// </value> | ||
| public bool Successful { get; internal set; } | ||
|
|
||
| /// <summary> | ||
| /// The authentication result if the token acquisition was successful. | ||
| /// </summary> | ||
| /// <value> | ||
| /// An <see cref="AuthenticationResult"/> containing the access token and related metadata if <see cref="Successful"/> is <c>true</c>; | ||
| /// otherwise, <c>null</c>. | ||
| /// </value> | ||
| public AuthenticationResult Result { get; internal set; } | ||
|
|
||
| /// <summary> | ||
| /// The exception that occurred if the token acquisition failed. | ||
| /// </summary> | ||
| /// <value> | ||
| /// An <see cref="MsalException"/> describing the failure if <see cref="Successful"/> is <c>false</c>; | ||
| /// otherwise, <c>null</c>. | ||
| /// </value> | ||
| public MsalException Exception { get; internal set; } | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.