Skip to content

Commit

Permalink
Updated to use ITfoxtec.Identity version 2.3.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
Revsgaard committed May 4, 2021
1 parent 81b7d36 commit 6323045
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ The component automatically handle token / session update with use of the refres
<PackageTags>Blazor WebAssembly OpenID Connect (OIDC) Proof Key for Code Exchange (PKCE) id token access token refresh token</PackageTags>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Copyright>© 2020 ITfoxtec</Copyright>
<AssemblyVersion>1.4.12.0</AssemblyVersion>
<FileVersion>1.4.12.0</FileVersion>
<Version>1.4.12</Version>
<AssemblyVersion>1.4.13.0</AssemblyVersion>
<FileVersion>1.4.13.0</FileVersion>
<Version>1.4.13</Version>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Blazored.SessionStorage" Version="1.0.13" />
<PackageReference Include="ITfoxtec.Identity" Version="2.2.4" />
<PackageReference Include="ITfoxtec.Identity" Version="2.3.0" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net5.0'">
Expand Down
4 changes: 2 additions & 2 deletions src/ITfoxtec.Identity.BlazorWA.Oidc/OpenidConnectPkce.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public async Task LoginCallBackAsync(string responseUrl)
var sessionResponse = responseQuery.ToObject<SessionResponse>();
sessionResponse.Validate();

var validUntil = DateTimeOffset.UtcNow.AddSeconds(tokenResponse.ExpiresIn).AddSeconds(-globalOpenidClientPkceSettings.TokensExpiresBefore);
var validUntil = DateTimeOffset.UtcNow.AddSeconds(tokenResponse.ExpiresIn.HasValue ? tokenResponse.ExpiresIn.Value : 0).AddSeconds(-globalOpenidClientPkceSettings.TokensExpiresBefore);
await (authenticationStateProvider as OidcAuthenticationStateProvider).CreateSessionAsync(validUntil, idTokenPrincipal, tokenResponse, sessionResponse.SessionState, openidClientPkceState);
navigationManager.NavigateTo(openidClientPkceState.RedirectUri, true);
}
Expand Down Expand Up @@ -201,7 +201,7 @@ public async Task<OidcUserSession> HandleRefreshTokenAsync(OidcUserSession userS
var subject = userSession.Claims.Where(c => c.Type == globalOpenidClientPkceSettings.NameClaimType).Select(c => c.Value).SingleOrDefault();
(var idTokenPrincipal, var tokenResponse) = await AcquireRefreshTokensAsync(userSession.OidcDiscoveryUri, userSession.ClientId, subject, userSession.RefreshToken);

var validUntil = DateTimeOffset.UtcNow.AddSeconds(tokenResponse.ExpiresIn).AddSeconds(-globalOpenidClientPkceSettings.TokensExpiresBefore);
var validUntil = DateTimeOffset.UtcNow.AddSeconds(tokenResponse.ExpiresIn.HasValue ? tokenResponse.ExpiresIn.Value : 0).AddSeconds(-globalOpenidClientPkceSettings.TokensExpiresBefore);
return await (authenticationStateProvider as OidcAuthenticationStateProvider).UpdateSessionAsync(validUntil, idTokenPrincipal, tokenResponse, userSession.SessionState, userSession);
}

Expand Down

0 comments on commit 6323045

Please sign in to comment.