maybe fix getting key shit
This commit is contained in:
@@ -104,24 +104,24 @@ public class ServerConfigurationManager
|
|||||||
var auth = currentServer.Authentications.FindAll(f => string.Equals(f.CharacterName, charaName) && f.WorldId == worldId);
|
var auth = currentServer.Authentications.FindAll(f => string.Equals(f.CharacterName, charaName) && f.WorldId == worldId);
|
||||||
if (auth.Count >= 2)
|
if (auth.Count >= 2)
|
||||||
{
|
{
|
||||||
_logger.LogTrace("GetSecretKey accessed, returning null because multiple ({count}) identical characters.", auth.Count);
|
_logger.LogTrace("GetOAuth2 accessed, returning null because multiple ({count}) identical characters.", auth.Count);
|
||||||
hasMulti = true;
|
hasMulti = true;
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (auth.Count == 0)
|
if (auth.Count == 0)
|
||||||
{
|
{
|
||||||
_logger.LogTrace("GetSecretKey accessed, returning null because no set up characters for {chara} on {world}", charaName, worldId);
|
_logger.LogTrace("GetOAuth2 accessed, returning null because no set up characters for {chara} on {world}", charaName, worldId);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(auth.Single().UID) && !string.IsNullOrEmpty(currentServer.OAuthToken))
|
if (!string.IsNullOrEmpty(auth.Single().UID) && !string.IsNullOrEmpty(currentServer.OAuthToken))
|
||||||
{
|
{
|
||||||
_logger.LogTrace("GetSecretKey accessed, returning {key} ({keyValue}) for {chara} on {world}", auth.Single().UID, string.Join("", currentServer.OAuthToken.Take(10)), charaName, worldId);
|
_logger.LogTrace("GetOAuth2 accessed, returning {key} ({keyValue}) for {chara} on {world}", auth.Single().UID, string.Join("", currentServer.OAuthToken.Take(10)), charaName, worldId);
|
||||||
return (currentServer.OAuthToken, auth.Single().UID!);
|
return (currentServer.OAuthToken, auth.Single().UID!);
|
||||||
}
|
}
|
||||||
|
|
||||||
_logger.LogTrace("GetSecretKey accessed, returning null because no UID found for {chara} on {world} or OAuthToken is not configured.", charaName, worldId);
|
_logger.LogTrace("GetOAuth2 accessed, returning null because no UID found for {chara} on {world} or OAuthToken is not configured.", charaName, worldId);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -162,17 +162,22 @@ public sealed class TokenProvider : IDisposable, IMediatorSubscriber
|
|||||||
|
|
||||||
if (_serverManager.CurrentServer.UseOAuth2)
|
if (_serverManager.CurrentServer.UseOAuth2)
|
||||||
{
|
{
|
||||||
var oauthInfo = _serverManager.GetOAuth2(out _)!;
|
var (OAuthToken, UID) = _serverManager.GetOAuth2(out _)
|
||||||
|
?? throw new InvalidOperationException("Requested OAuth2 but received null");
|
||||||
|
|
||||||
jwtIdentifier = new(_serverManager.CurrentApiUrl,
|
jwtIdentifier = new(_serverManager.CurrentApiUrl,
|
||||||
playerIdentifier,
|
playerIdentifier,
|
||||||
oauthInfo.Value.UID, oauthInfo.Value.OAuthToken);
|
UID, OAuthToken);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
var secretKey = _serverManager.GetSecretKey(out _)
|
||||||
|
?? throw new InvalidOperationException("Requested SecretKey but received null");
|
||||||
|
|
||||||
jwtIdentifier = new(_serverManager.CurrentApiUrl,
|
jwtIdentifier = new(_serverManager.CurrentApiUrl,
|
||||||
playerIdentifier,
|
playerIdentifier,
|
||||||
string.Empty,
|
string.Empty,
|
||||||
_serverManager.GetSecretKey(out _)!);
|
secretKey);
|
||||||
}
|
}
|
||||||
_lastJwtIdentifier = jwtIdentifier;
|
_lastJwtIdentifier = jwtIdentifier;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user