Initial commit.

This commit is contained in:
Burak Kaan Köse
2024-04-18 01:44:37 +02:00
parent 524ea4c0e1
commit 12d3814626
671 changed files with 77295 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
using System;
using Microsoft.Identity.Client;
using Wino.Core.Domain.Entities;
namespace Wino.Core.Extensions
{
public static class TokenizationExtensions
{
public static TokenInformation CreateTokenInformation(this AuthenticationResult clientBuilderResult)
{
var expirationDate = clientBuilderResult.ExpiresOn.UtcDateTime;
var accesToken = clientBuilderResult.AccessToken;
var userName = clientBuilderResult.Account.Username;
// MSAL does not expose refresh token for security reasons.
// This token info will be created without refresh token.
// but OutlookIntegrator will ask for publicApplication to refresh it
// in case of expiration.
var tokenInfo = new TokenInformation()
{
ExpiresAt = expirationDate,
AccessToken = accesToken,
Address = userName,
Id = Guid.NewGuid(),
};
return tokenInfo;
}
}
}