Skip to content

Commit

Permalink
Fix ExampleEnforcingUserAuthenticator
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcusLongmuir committed Apr 19, 2024
1 parent 9613f49 commit 3584429
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ export class ExampleEnforcingUserAuthenticator {
if (foundCharacter) {
resultCharacterDescription = foundCharacter;
}
}
if (resultPermissions.allowUsername && req.query.username) {
resultUsername = req.query.username as string;
}

Expand Down Expand Up @@ -237,6 +239,19 @@ export class ExampleEnforcingUserAuthenticator {
return user.userData;
}

public getClientIdForSessionToken(sessionToken: string): { id: number } | null {
const user = this.userBySessionToken.get(sessionToken);
if (!user) {
console.error("getClientIdForSessionToken - unknown session");
return null;
}
if (user.clientId === null) {
console.error("getClientIdForSessionToken - client not connected");
return null;
}
return { id: user.clientId };
}

public onClientUserIdentityUpdate(
clientId: number,
newUserIdentity: UserIdentity,
Expand Down

0 comments on commit 3584429

Please sign in to comment.