Add legacy authentication and session routes
Introduces legacy endpoints for login, joinserver, and checkserver, along with their input validation schemas. Updates sessionsService with joinLegacyServer to support legacy session handling. This enables compatibility with legacy clients requiring these authentication flows.
This commit is contained in:
@@ -152,10 +152,26 @@ async function hasJoinedServer({ username, serverId, ip }) {
|
||||
})
|
||||
}
|
||||
|
||||
async function joinLegacyServer({ name, sessionId, serverId }) {
|
||||
try {
|
||||
await validateLegacySession({ name, sessionId })
|
||||
} catch (error) {
|
||||
throw new DefaultError(403, "Bad login", "ForbiddenOperationException")
|
||||
}
|
||||
|
||||
const userResult = await authRepository.getUser(name)
|
||||
const uuid = userResult.user.uuid
|
||||
|
||||
await sessionRepository.saveServerSession(uuid, sessionId, serverId, "0.0.0.0")
|
||||
|
||||
return { code: 200, message: "OK" }
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
getProfile,
|
||||
joinServer,
|
||||
hasJoinedServer,
|
||||
joinLegacyServer,
|
||||
getBlockedServers,
|
||||
registerLegacySession,
|
||||
validateLegacySession,
|
||||
|
||||
Reference in New Issue
Block a user