Mostly working websocket stuff, some message weirdness at the moment...
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user