|
@@ -156,8 +156,8 @@ public class OcppWebsocketService : WebsocketService<WsClientData>
|
|
|
|
|
|
if (!isExistedSN)
|
|
|
{
|
|
|
+ logger.LogTrace("{id} {func} not found", context.TraceIdentifier, nameof(ValidateHandshake));
|
|
|
context.Response.StatusCode = StatusCodes.Status404NotFound;
|
|
|
- logger.LogTrace("{id} {func} {Statuscode}", context.TraceIdentifier, nameof(ValidateHandshake), context.Response.StatusCode);
|
|
|
return false;
|
|
|
}
|
|
|
|
|
@@ -182,10 +182,15 @@ public class OcppWebsocketService : WebsocketService<WsClientData>
|
|
|
securityProfile = 0;
|
|
|
}
|
|
|
|
|
|
+ if (securityProfile == 0)
|
|
|
+ {
|
|
|
+ authorizated = true;
|
|
|
+ }
|
|
|
+
|
|
|
if (securityProfile == 3 && session.UriScheme == "ws")
|
|
|
{
|
|
|
+ logger.LogTrace("{id} {func} {securityProfile} auth failed", context.TraceIdentifier, nameof(ValidateHandshake), securityProfile);
|
|
|
context.Response.StatusCode = StatusCodes.Status401Unauthorized;
|
|
|
- logger.LogTrace("{id} {func} {Statuscode}", context.TraceIdentifier, nameof(ValidateHandshake), context.Response.StatusCode);
|
|
|
return false;
|
|
|
}
|
|
|
|
|
@@ -193,16 +198,16 @@ public class OcppWebsocketService : WebsocketService<WsClientData>
|
|
|
{
|
|
|
if (securityProfile == 2 && session.UriScheme == "ws")
|
|
|
{
|
|
|
+ logger.LogTrace("{id} {func} {securityProfile} auth failed", context.TraceIdentifier, nameof(ValidateHandshake), securityProfile);
|
|
|
context.Response.StatusCode = StatusCodes.Status401Unauthorized;
|
|
|
- logger.LogTrace("{id} {func} {Statuscode}", context.TraceIdentifier, nameof(ValidateHandshake), context.Response.StatusCode);
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
//if (session.Items.ContainsKey("Authorization") || session.Items.ContainsKey("authorization"))
|
|
|
if (string.IsNullOrEmpty(authHeader))
|
|
|
{
|
|
|
+ logger.LogTrace("{id} {func} {securityProfile} auth failed", context.TraceIdentifier, nameof(ValidateHandshake), securityProfile);
|
|
|
context.Response.StatusCode = StatusCodes.Status401Unauthorized;
|
|
|
- logger.LogTrace("{id} {func} {Statuscode}", context.TraceIdentifier, nameof(ValidateHandshake), context.Response.StatusCode);
|
|
|
return false;
|
|
|
}
|
|
|
//authorizationKey = db.MachineConfigurations.Where(x => x.ChargeBoxId == session.ChargeBoxId && x.ConfigureName == StandardConfiguration.AuthorizationKey)
|
|
@@ -234,8 +239,8 @@ public class OcppWebsocketService : WebsocketService<WsClientData>
|
|
|
|
|
|
if (!authorizated)
|
|
|
{
|
|
|
+ logger.LogTrace("{id} {func} {securityProfile} auth failed", context.TraceIdentifier, nameof(ValidateHandshake), securityProfile);
|
|
|
context.Response.StatusCode = StatusCodes.Status401Unauthorized;
|
|
|
- logger.LogTrace("{id} {func} {Statuscode}", context.TraceIdentifier, nameof(ValidateHandshake), context.Response.StatusCode);
|
|
|
return false;
|
|
|
}
|
|
|
}
|