-
Notifications
You must be signed in to change notification settings - Fork 235
Microsoft.Identity.Web token acquisition extensions #3005
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
Merged
Merged
Changes from 7 commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
7e1f503
First cut or proto for IdWeb add-ins
jmprieur 5fbeaad
Merge branch 'master' into jmprieur/IdWebAddIns
jmprieur f4c2987
Merge branch 'master' into jmprieur/IdWebAddIns
jmprieur 71fddc2
Preparing work for CDT
jmprieur d785a30
fix clone issue
jennyf19 ef135ef
remove cdt tests
jennyf19 b632fc0
remove test
jennyf19 77bab04
remove endProject
jennyf19 b1932b3
fix sln
jennyf19 89524cc
Apply suggestions from code review
jennyf19 39f904c
Updarting to MSAL.NET 4.65.2-preview
jmprieur 24afdc3
Update NuGet.Config
jmprieur 73ff6a4
Update NuGet.Config
jmprieur 2bee7c8
Update NuGet.Config
jmprieur bc452d9
Update NuGet.Config
jmprieur 21fe340
Merge from master
jmprieur 552b9e1
Updating the signature of the delegates
jmprieur 7b03eb8
Update to use MSAL.NET preview
jmprieur 8ab01cc
Fixing a cloning issue
jmprieur 357e49d
Merge from master
jmprieur 88abe2c
use msal preview version
jennyf19 244d4bb
Update from master
jmprieur 7942f6b
id web extension updates (#3100)
trwalke 3f6cfa1
Merge branch 'master' into jmprieur/IdWebAddIns
jmprieur 72d8d81
Fix Unshipped files for TokenAcquisition
jmprieur File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
src/Microsoft.Identity.Web.TokenAcquisition/TokenAcquisitionAddIn.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
using Microsoft.Extensions.DependencyInjection; | ||
using Microsoft.Identity.Abstractions; | ||
using Microsoft.Identity.Client; | ||
|
||
namespace Microsoft.Identity.Web | ||
{ | ||
/// <summary> | ||
/// Signature for token acquisition extensions that act on the application builder. | ||
/// </summary> | ||
/// <param name="confidentialClientApplicationBuilder">Application builder.</param> | ||
/// <param name="acquireTokenOptions">Token acquisition options.</param> | ||
public delegate void BuildApplication(ConfidentialClientApplicationBuilder confidentialClientApplicationBuilder, AcquireTokenOptions acquireTokenOptions); | ||
|
||
/// <summary> | ||
/// Signature for token acquisition extensions that act on the request builder, for an app token | ||
/// </summary> | ||
/// <param name="builder">Builder</param> | ||
/// <param name="acquireTokenOptions">Token acquisition options for the request.</param> | ||
public delegate void BeforeTokenAcquisitionForApp(AcquireTokenForClientParameterBuilder builder, AcquireTokenOptions acquireTokenOptions); | ||
jmprieur marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
/// <summary> | ||
/// Signature for token acquisition extensions that act on the application builder. | ||
/// </summary> | ||
/// <param name="authResult">MSAL.NET authentication result</param> | ||
/// <param name="acquireTokenOptions">Token acquisition options for the request.</param> | ||
public delegate void AfterTokenAcquisition(AuthenticationResult authResult, AcquireTokenOptions acquireTokenOptions); | ||
|
||
/// <summary> | ||
/// Options for TokenAcquisition add-ins. These options consist in a set of events, that can be subscribed to by add-ins | ||
/// or parts of the add-ins. | ||
/// </summary> | ||
public class TokenAcquisitionAddInOptions | ||
jmprieur marked this conversation as resolved.
Show resolved
Hide resolved
|
||
{ | ||
/// <summary> | ||
/// Event fired when the MSAL application needs to be built. | ||
/// </summary> | ||
public event BuildApplication? OnBuildConfidentialClientApplication; | ||
jmprieur marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
/// <summary> | ||
/// Event fired when a client credential flow request is being built. | ||
/// </summary> | ||
public event BeforeTokenAcquisitionForApp? OnBeforeTokenAcquisitionForApp; | ||
|
||
|
||
/// <summary> | ||
/// Event fired when an authentication result is available. | ||
/// </summary> | ||
public event AfterTokenAcquisition? OnAfterTokenAcquisition; | ||
jmprieur marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
internal void InvokeOnBuildConfidentialClientApplication(ConfidentialClientApplicationBuilder builder, | ||
AcquireTokenOptions acquireTokenOptions) | ||
{ | ||
if (OnBuildConfidentialClientApplication != null) | ||
{ | ||
OnBuildConfidentialClientApplication(builder, acquireTokenOptions); | ||
} | ||
} | ||
|
||
|
||
internal void InvokeOnBeforeTokenAcquisitionForApp(AcquireTokenForClientParameterBuilder builder, | ||
AcquireTokenOptions acquireTokenOptions) | ||
{ | ||
if (OnBeforeTokenAcquisitionForApp != null) | ||
{ | ||
OnBeforeTokenAcquisitionForApp(builder, acquireTokenOptions); | ||
} | ||
} | ||
|
||
internal void InvokeOnAfterTokenAcquisition(AuthenticationResult result, | ||
AcquireTokenOptions acquireTokenOptions) | ||
{ | ||
if (OnAfterTokenAcquisition != null) | ||
{ | ||
OnAfterTokenAcquisition(result, acquireTokenOptions); | ||
} | ||
} | ||
|
||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.