Skip to content

Commit

Permalink
Add LoginResponse for PSP
Browse files Browse the repository at this point in the history
  • Loading branch information
jvyden committed Sep 2, 2023
1 parent 5efddf9 commit b2a5937
Showing 1 changed file with 18 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class AuthenticationEndpoints : EndpointGroup
[NullStatusCode(Forbidden)]
[RateLimitSettings(300, 10, 300, "auth")]
[MinimumRole(GameUserRole.Restricted)]
public LoginResponse? Authenticate(RequestContext context,
public object? Authenticate(RequestContext context,
GameDatabaseContext database,
Stream body,
GameServerConfig config,
Expand Down Expand Up @@ -155,7 +155,15 @@ public class AuthenticationEndpoints : EndpointGroup

Token token = database.GenerateTokenForUser(user, TokenType.Game, game.Value, platform.Value, GameDatabaseContext.GameTokenExpirySeconds); // 4 hours

return new LoginResponse
if (game == TokenGame.LittleBigPlanetPSP)
{
return new TicketLoginResponse
{
TokenData = "MM_AUTH=" + token.TokenData,
};
}

return new FullLoginResponse
{
TokenData = "MM_AUTH=" + token.TokenData,
ServerBrand = "Refresh",
Expand Down Expand Up @@ -258,11 +266,18 @@ public Response RevokeThisToken(RequestContext context, GameDatabaseContext data
}

[XmlRoot("loginResult")]
public struct LoginResponse
public struct FullLoginResponse
{
[XmlElement("authTicket")]
public string TokenData { get; set; }

[XmlElement("lbpEnvVer")]
public string ServerBrand { get; set; }
}

[XmlRoot("authTicket")]
public struct TicketLoginResponse
{
[XmlText]
public string TokenData { get; set; }
}

0 comments on commit b2a5937

Please sign in to comment.