always check authentication
This commit is contained in:
@@ -481,10 +481,9 @@ public class ApiServer : IApiServer
|
||||
// Check authentication
|
||||
Log.Debug("Check authentication");
|
||||
var isAuthenticated = false;
|
||||
if (!string.IsNullOrWhiteSpace(authKey) && DecodeAuthKey(authKey) is string authKeyDecoded)
|
||||
isAuthenticated = CheckAuthentication(authKeyDecoded, handler.Handler, context);
|
||||
else
|
||||
if (string.IsNullOrWhiteSpace(authKey) || DecodeAuthKey(authKey) is not string authKeyDecoded)
|
||||
authKeyDecoded = null!;
|
||||
isAuthenticated = CheckAuthentication(authKeyDecoded, handler.Handler, context);
|
||||
if (handler.Attribute.RequiesAuth && !isAuthenticated)
|
||||
return new(ApiResult.Unauthorized(), null);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user