Merge pull request #2472 from unoplatform/dev/nr/idtoken
feat: Saving IdToken
This commit is contained in:
Коммит
fbe8ccf3f1
|
@ -37,6 +37,7 @@ internal record OidcAuthenticationProvider(
|
|||
|
||||
var token = authenticationResult.AccessToken;
|
||||
var refreshToken = authenticationResult.RefreshToken;
|
||||
var idToken = authenticationResult.IdentityToken;
|
||||
|
||||
if (token is not null)
|
||||
{
|
||||
|
@ -46,6 +47,11 @@ internal record OidcAuthenticationProvider(
|
|||
creds[TokenCacheExtensions.RefreshTokenKey] = refreshToken;
|
||||
}
|
||||
|
||||
if (idToken is not null)
|
||||
{
|
||||
creds[TokenCacheExtensions.IdTokenKey] = idToken;
|
||||
}
|
||||
|
||||
return creds;
|
||||
}
|
||||
return default;
|
||||
|
@ -73,6 +79,7 @@ internal record OidcAuthenticationProvider(
|
|||
var result = await _client.RefreshTokenAsync(token);
|
||||
var accessToken = result.AccessToken;
|
||||
var refreshToken = result.RefreshToken;
|
||||
var idToken = result.IdentityToken;
|
||||
|
||||
if (token is not null)
|
||||
{
|
||||
|
@ -82,6 +89,11 @@ internal record OidcAuthenticationProvider(
|
|||
creds[TokenCacheExtensions.RefreshTokenKey] = refreshToken;
|
||||
}
|
||||
|
||||
if (idToken is not null)
|
||||
{
|
||||
creds[TokenCacheExtensions.IdTokenKey] = idToken;
|
||||
}
|
||||
|
||||
return creds;
|
||||
}
|
||||
return default;
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
|
||||
|
||||
using System.Threading;
|
||||
using Uno.Extensions.Serialization;
|
||||
using Uno.Extensions.Serialization;
|
||||
|
||||
namespace Uno.Extensions.Authentication;
|
||||
|
||||
|
@ -20,6 +17,11 @@ public static class TokenCacheExtensions
|
|||
/// </summary>
|
||||
public const string RefreshTokenKey = "RefreshToken";
|
||||
|
||||
/// <summary>
|
||||
/// Defines a key for the token cache which corresponds to an ID token element.
|
||||
/// </summary>
|
||||
public const string IdTokenKey = "IdToken";
|
||||
|
||||
/// <summary>
|
||||
/// Gets the access token from the token cache.
|
||||
/// </summary>
|
||||
|
|
Загрузка…
Ссылка в новой задаче