Skip to content

move obo call to earlier#383

Merged
jennyf19 merged 5 commits into
masterfrom
jennyf/switchSilentCall
Aug 4, 2020
Merged

move obo call to earlier#383
jennyf19 merged 5 commits into
masterfrom
jennyf/switchSilentCall

Conversation

@jennyf19

@jennyf19 jennyf19 commented Aug 1, 2020

Copy link
Copy Markdown
Collaborator

#381
cc: @jmprieur
Needs a lot of manual testing:

  • WebAppCallsWebApiCallsGraph
  • B2C WebAppCallsWebApi

jennyf19 and others added 3 commits July 31, 2020 12:46
* Fix nullable warnings. (#362)

* fix userflow claims in addAccounToCacheFromAuthCode (#388)

* make aadIssuerValidator public (#385)

* Fixes Azure DevOps issue 1097354 (#387)

Co-authored-by: pmaytak <34331512+pmaytak@users.noreply.github.com>
Co-authored-by: jennyf19 <jeferrie@microsoft.com>
@jmprieur

jmprieur commented Aug 3, 2020

Copy link
Copy Markdown
Collaborator

@jennyf19 tested the Web API incremental tutorial which is now way faster when doing OBO. This is perceivable from the UI of the client when adding a todo item it's now super fast.

@jennyf19
jennyf19 marked this pull request as ready for review August 3, 2020 17:23
public const string SerializingSessionCache = "Serializing session {0}, cache key {1}. ";
public const string ClearingSessionCache = "Clearing session {0}, cache key {1}. ";

public const string ErrorAcquiringTokenForOboForWebApi = "Error acquiring a token for obo for a web API - MsalUiRequiredException message is: {0} .";

@pmaytak pmaytak Aug 4, 2020

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public const string ErrorAcquiringTokenForOboForWebApi = "Error acquiring a token for obo for a web API - MsalUiRequiredException message is: {0} .";
public const string ErrorAcquiringTokenForOboForWebApi = "Error acquiring a token for On-Behalf-Of flow for a web API - MsalUiRequiredException message is: {0} .";
``` #Resolved

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'm going to call it downstream web api instead, as OBO is not a flow, and it is confusing for a customer. thanks, peter. :)


In reply to: 464802916 [](ancestors = 464802916)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, downstream API makes sense.

Yea, idk I got the phrase from MS docs: https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-on-behalf-of-flow. :)

try
{
// In web API, validatedToken will not be null
JwtSecurityToken? validatedToken = CurrentHttpContext.GetTokenUsedToCallWebAPI();

@pmaytak pmaytak Aug 4, 2020

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
JwtSecurityToken? validatedToken = CurrentHttpContext.GetTokenUsedToCallWebAPI();
JwtSecurityToken? validatedToken = CurrentHttpContext?.GetTokenUsedToCallWebAPI();
``` #Resolved

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed. thanks


In reply to: 464810227 [](ancestors = 464810227)


private async Task<ClaimsPrincipal?> GetAuthenticatedUserAsync(ClaimsPrincipal? user)
{
if (user == null && _httpContextAccessor.HttpContext != null)

@pmaytak pmaytak Aug 4, 2020

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (user == null && _httpContextAccessor.HttpContext != null)
if (user == null && _httpContextAccessor.HttpContext?.User != null)
``` #Resolved

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

got it. thanks!


In reply to: 464811695 [](ancestors = 464811695)

@jmprieur jmprieur left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.
Thanks @jennyf19. I tested on test apps and the Web API incremental tutorial.
Thanks for the suggestions @pmaytak

@jennyf19
jennyf19 merged commit 9fefbb3 into master Aug 4, 2020
@jennyf19
jennyf19 deleted the jennyf/switchSilentCall branch August 4, 2020 18:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants