mirror of
https://github.com/DorkSquadRR/DorkNet.git
synced 2026-10-27 16:08:47 -07:00
Support native game auth client
This commit is contained in:
@@ -131,6 +131,8 @@ public static class RecRoomIdentityServerRegistration
|
|||||||
internal static class RecRoomIdentityServerConfig
|
internal static class RecRoomIdentityServerConfig
|
||||||
{
|
{
|
||||||
public const string ClientId = "recroom.client";
|
public const string ClientId = "recroom.client";
|
||||||
|
public const string NativeClientId = "recroom";
|
||||||
|
public const string NativeClientSecret = "VxZ53kgbbEaRoZAeMe00MagtgD12GLL2";
|
||||||
public const string GameClientScope = "gameClient";
|
public const string GameClientScope = "gameClient";
|
||||||
public const string CachedLoginGrantType = "cached_login";
|
public const string CachedLoginGrantType = "cached_login";
|
||||||
|
|
||||||
@@ -157,17 +159,27 @@ internal static class RecRoomIdentityServerConfig
|
|||||||
new()
|
new()
|
||||||
{
|
{
|
||||||
ClientId = ClientId,
|
ClientId = ClientId,
|
||||||
ClientName = "Rec Room Client",
|
ClientName = "Rec Room compatibility client",
|
||||||
RequireClientSecret = false,
|
RequireClientSecret = false,
|
||||||
AllowedGrantTypes = { GrantType.ResourceOwnerPassword, CachedLoginGrantType },
|
AllowedGrantTypes = { GrantType.ResourceOwnerPassword, GrantType.RefreshToken, CachedLoginGrantType },
|
||||||
AllowedScopes =
|
AllowedScopes = RecRoomScopes(),
|
||||||
{
|
AllowOfflineAccess = true,
|
||||||
IdentityServerConstants.StandardScopes.OpenId,
|
AccessTokenLifetime = 60 * 60 * 12,
|
||||||
IdentityServerConstants.StandardScopes.Profile,
|
AbsoluteRefreshTokenLifetime = 60 * 60 * 24 * 30,
|
||||||
IdentityServerConstants.StandardScopes.OfflineAccess,
|
SlidingRefreshTokenLifetime = 60 * 60 * 24 * 30,
|
||||||
GameClientScope,
|
RefreshTokenUsage = TokenUsage.ReUse,
|
||||||
"api",
|
RefreshTokenExpiration = TokenExpiration.Absolute,
|
||||||
|
UpdateAccessTokenClaimsOnRefresh = true,
|
||||||
|
AlwaysIncludeUserClaimsInIdToken = true,
|
||||||
},
|
},
|
||||||
|
new()
|
||||||
|
{
|
||||||
|
ClientId = NativeClientId,
|
||||||
|
ClientName = "Rec Room native client",
|
||||||
|
RequireClientSecret = true,
|
||||||
|
ClientSecrets = { new Secret(NativeClientSecret.Sha256()) },
|
||||||
|
AllowedGrantTypes = { GrantType.ResourceOwnerPassword, GrantType.RefreshToken, CachedLoginGrantType },
|
||||||
|
AllowedScopes = RecRoomScopes(),
|
||||||
AllowOfflineAccess = true,
|
AllowOfflineAccess = true,
|
||||||
AccessTokenLifetime = 60 * 60 * 12,
|
AccessTokenLifetime = 60 * 60 * 12,
|
||||||
AbsoluteRefreshTokenLifetime = 60 * 60 * 24 * 30,
|
AbsoluteRefreshTokenLifetime = 60 * 60 * 24 * 30,
|
||||||
@@ -178,6 +190,15 @@ internal static class RecRoomIdentityServerConfig
|
|||||||
AlwaysIncludeUserClaimsInIdToken = true,
|
AlwaysIncludeUserClaimsInIdToken = true,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private static ICollection<string> RecRoomScopes() =>
|
||||||
|
[
|
||||||
|
IdentityServerConstants.StandardScopes.OpenId,
|
||||||
|
IdentityServerConstants.StandardScopes.Profile,
|
||||||
|
IdentityServerConstants.StandardScopes.OfflineAccess,
|
||||||
|
GameClientScope,
|
||||||
|
"api",
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed class IdentityServerLegacyTokenRequestMiddleware(RequestDelegate next)
|
public sealed class IdentityServerLegacyTokenRequestMiddleware(RequestDelegate next)
|
||||||
|
|||||||
Reference in New Issue
Block a user