Skip to content

Commit befa2fe

Browse files
Minor refactoring
Tidy-up the spacing to match the other providers. Declare variable when needed.
1 parent 6636881 commit befa2fe

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/AspNet.Security.OAuth.SuperOffice/SuperOfficeAuthenticationHandler.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,12 @@ protected override async Task<AuthenticationTicket> CreateTicketAsync(
7171
}
7272

7373
using var payload = JsonDocument.Parse(await response.Content.ReadAsStringAsync());
74-
var context = new OAuthCreatingTicketContext(new ClaimsPrincipal(identity), properties, Context, Scheme, Options, Backchannel, tokens, payload.RootElement);
74+
75+
var principal = new ClaimsPrincipal(identity);
76+
77+
var context = new OAuthCreatingTicketContext(principal, properties, Context, Scheme, Options, Backchannel, tokens, payload.RootElement);
7578
context.RunClaimActions();
79+
7680
await Events.CreatingTicket(context);
7781
return new AuthenticationTicket(context.Principal, context.Properties, Scheme.Name);
7882
}
@@ -82,8 +86,6 @@ private async Task<string> ProcessIdTokenAndGetContactIdentifierAsync(
8286
[NotNull] AuthenticationProperties properties,
8387
[NotNull] ClaimsIdentity identity)
8488
{
85-
var contextIdentifier = string.Empty;
86-
8789
var idToken = tokens.Response.RootElement.GetString("id_token");
8890

8991
if (Options.SaveTokens)
@@ -94,6 +96,8 @@ private async Task<string> ProcessIdTokenAndGetContactIdentifierAsync(
9496

9597
var tokenValidationResult = await ValidateAsync(idToken, Options.TokenValidationParameters.Clone());
9698

99+
var contextIdentifier = string.Empty;
100+
97101
foreach (var claim in tokenValidationResult.ClaimsIdentity.Claims)
98102
{
99103
if (claim.Type == SuperOfficeAuthenticationConstants.ClaimNames.ContextIdentifier)

0 commit comments

Comments
 (0)