Mostly working websocket stuff, some message weirdness at the moment...

This commit is contained in:
Nate Anderson
2025-02-10 18:55:15 -07:00
parent 623474e0c6
commit b37862a321
19 changed files with 543 additions and 87 deletions
+7 -2
View File
@@ -24,8 +24,13 @@ Middleware tokenAuthMiddleware({
// use `auth.verifyToken(token)` to check the jwt that came in the request header bearer
final authHeader = context.request.headers['authorization'] ?? context.request.headers['Authorization'];
final auths = authHeader?.split(' ');
if (authHeader == null || !authHeader.startsWith('Bearer ') || auths == null || auths.length != 2) {
log.fine('Denied request - No Auth - ${context.request.method.value} ${context.request.uri.path}');
if (authHeader == null ||
!authHeader.toLowerCase().startsWith('bearer') ||
auths == null ||
auths.length != 2) {
log.fine(
'Denied request, no Auth - ${context.request.method.value} ${context.request.uri.path}, Found $auths',
);
return Response(statusCode: HttpStatus.unauthorized);
}
final token = auths.last;