You've already forked CC-Framework.BriskGameServer
41 lines
1.1 KiB
C#
41 lines
1.1 KiB
C#
using System;
|
|
|
|
public sealed class BriskSession
|
|
{
|
|
public string AccessToken { get; private set; }
|
|
|
|
public DateTimeOffset? ExpiresAt { get; private set; }
|
|
|
|
public BriskIdentity Identity { get; private set; } = new BriskIdentity();
|
|
|
|
public string PlayerId => Identity.PlayerId;
|
|
|
|
public string ProjectAccountId => Identity.ProjectAccountId;
|
|
|
|
public string LoginProvider => Identity.LoginProvider;
|
|
|
|
public string LoginUserId => Identity.LoginUserId;
|
|
|
|
public bool HasAccessToken => !string.IsNullOrWhiteSpace(AccessToken);
|
|
|
|
public void Update(string accessToken, DateTimeOffset? expiresAt, string playerId, string projectAccountId, string loginProvider = null, string loginUserId = null)
|
|
{
|
|
AccessToken = accessToken;
|
|
ExpiresAt = expiresAt;
|
|
Identity = new BriskIdentity
|
|
{
|
|
PlayerId = playerId,
|
|
ProjectAccountId = projectAccountId,
|
|
LoginProvider = loginProvider,
|
|
LoginUserId = loginUserId
|
|
};
|
|
}
|
|
|
|
public void Clear()
|
|
{
|
|
AccessToken = null;
|
|
ExpiresAt = null;
|
|
Identity = new BriskIdentity();
|
|
}
|
|
}
|