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