Merge branch 'develop' of github.com:thecodingmachine/workadventure

This commit is contained in:
_Bastler
2021-12-07 20:42:02 +01:00
8 changed files with 205 additions and 86 deletions
+7 -1
View File
@@ -1,5 +1,6 @@
import { ADMIN_SOCKETS_TOKEN, SECRET_KEY } from "../Enum/EnvironmentVariable";
import Jwt from "jsonwebtoken";
import { InvalidTokenError } from "../Controller/InvalidTokenError";
export interface AuthTokenData {
identifier: string; //will be a sub (id) if logged in or an uuid if anonymous
@@ -24,7 +25,12 @@ class JWTTokenManager {
try {
return Jwt.verify(token, SECRET_KEY, { ignoreExpiration }) as AuthTokenData;
} catch (e) {
throw { reason: tokenInvalidException, message: e.message };
if (e instanceof Error) {
// FIXME: we are loosing the stacktrace here.
throw new InvalidTokenError(e.message);
} else {
throw e;
}
}
}
}
+6
View File
@@ -133,6 +133,12 @@ export class SocketManager implements ZoneEventListener {
const message = new AdminPusherToBackMessage();
message.setSubscribetoroom(roomId);
console.log(
`Admin socket handle room ${roomId} connections for a client on ${Buffer.from(
client.getRemoteAddressAsText()
).toString()}`
);
adminRoomStream.write(message);
}