Skip to content
This repository was archived by the owner on Feb 23, 2025. It is now read-only.

Commit 3656b79

Browse files
authored
Added Identity Token to TokenRefreshEventArgs (#367)
* Added Identity Token to TokenRefreshEventArgs This change allows updating the identity token cached at the client with the latest identity token coming from token renewal * Make Identity Token optional in TokenRefreshEventArgs to prevent breaking changes
1 parent 46d7b25 commit 3656b79

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

src/OidcClient/RefreshTokenDelegatingHandler.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ private async Task<bool> RefreshTokensAsync(CancellationToken cancellationToken)
180180
{
181181
try
182182
{
183-
del(this, new TokenRefreshedEventArgs(response.AccessToken, response.RefreshToken, (int)response.ExpiresIn));
183+
del(this, new TokenRefreshedEventArgs(response.AccessToken, response.RefreshToken, response.ExpiresIn, response.IdentityToken));
184184
}
185185
catch { }
186186
}

src/OidcClient/TokenRefreshedEventArgs.cs

+10-1
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,12 @@ public class TokenRefreshedEventArgs : EventArgs
1717
/// <param name="accessToken">The access token.</param>
1818
/// <param name="refreshToken">The refresh token.</param>
1919
/// <param name="expiresIn">The expires in.</param>
20-
public TokenRefreshedEventArgs(string accessToken, string refreshToken, int expiresIn)
20+
public TokenRefreshedEventArgs(string accessToken, string refreshToken, int expiresIn, string identityToken = null)
2121
{
2222
AccessToken = accessToken;
2323
RefreshToken = refreshToken;
2424
ExpiresIn = expiresIn;
25+
IdentityToken = identityToken;
2526
}
2627

2728
/// <summary>
@@ -47,5 +48,13 @@ public TokenRefreshedEventArgs(string accessToken, string refreshToken, int expi
4748
/// The expires in.
4849
/// </value>
4950
public int ExpiresIn { get; }
51+
52+
/// <summary>
53+
/// Gets the identity token.
54+
/// </summary>
55+
/// <value>
56+
/// The identity token.
57+
/// </value>
58+
public string IdentityToken { get; }
5059
}
5160
}

0 commit comments

Comments
 (0)