Skip to content

Commit b71fb6f

Browse files
committed
chore(EtsyTests): apply workaround into PostConfigure test
User side Post configure is later than provider side post configure. this causes the Scope not to be evaluated and the Mappings are not applyed automatically HACK: add them all manually for the test postConfigure until decision is made this could be put in validate override or always consumer side?
1 parent 05aa969 commit b71fb6f

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

test/AspNet.Security.OAuth.Providers.Tests/Etsy/EtsyTests.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,17 @@ void ConfigureServices(IServiceCollection services) => services.PostConfigureAll
6060
{
6161
o.IncludeDetailedUserInfo = true;
6262

63-
// User to include image claim
63+
// Ensure the required scope is present before Validate() executes.
64+
// BUG: This should not be necessary as the post-configure should add it. Assuming test Arrange should simulate eventual user setup.
65+
if (!o.Scope.Contains(Scopes.EmailRead))
66+
{
67+
o.Scope.Add(Scopes.EmailRead);
68+
o.ClaimActions.MapJsonKey(ClaimTypes.Email, "primary_email");
69+
o.ClaimActions.MapJsonKey(ClaimTypes.GivenName, "first_name");
70+
o.ClaimActions.MapJsonKey(ClaimTypes.Surname, "last_name");
71+
}
72+
73+
// Opt-in to include image claim (not auto-mapped by provider to reduce payload size)
6474
o.ClaimActions.MapImageClaim();
6575
});
6676

0 commit comments

Comments
 (0)