-
Notifications
You must be signed in to change notification settings - Fork 189
Open
Description
I'm using a Java library for my ocpp operations. groupId of pom dependencies: eu.chargetime.ocpp.
Right now I'm trying to implement the authenticateSession method from ServerEvents, so that anytime a wallbox requests a connection to our backend, we validate the input password that comes as byte array. However, for some reason in most of the wallboxes that my company owns the password field comes as null, despite adding a password in the authorizationKey text field of their UI-s.
How do you usually handle the basic auth workflow for such cases? Has anyone ever faced a similar issue and how have you managed to resolve it?
I am attaching my code snippet for ServerEventConfig.java
public ServerEvents createServerCoreImpl() {
return getNewServerEventsImpl();
}
private ServerEvents getNewServerEventsImpl() {
return new ServerEvents() {
@Override
public void newSession(UUID sessionIndex, SessionInformation information) {
log.info("New session " + sessionIndex + ": " + information.getIdentifier());
log.info("InetSocketAddress: " + information.getAddress());
log.info("Soap to URL: " + information.getSOAPtoURL());
sessionHandler.addSession(information.getIdentifier(), sessionIndex);
SessionDetail sessionDetailsToStore = sessionHandler.buildWebSocketSession(information.getIdentifier().substring(1) , sessionIndex.toString());
sessionHandler.storeSessionInSessionCollection(sessionDetailsToStore);
executePostSessionActions(sessionIndex);
}
@Override
public void lostSession(UUID sessionIndex) {
LocalDateTime eventTimestamp = LocalDateTime.now();
String identifier = sessionHandler.getCpIdBySessionId(sessionIndex);
log.info("Session " + sessionIndex + " having identifier: " + identifier + " lost connection");
String connectorId = sessionHandler.getCpIdBySessionId(sessionIndex);
sessionHandler.deleteSession(connectorId, sessionIndex);
sessionHandler.deleteSessionFromDb(sessionIndex.toString());
sessionHandler.handlerConnectorStatusOnConnectionLost(connectorId, eventTimestamp);
}
@Override
public void authenticateSession(SessionInformation information, String username, byte[] password) throws AuthenticationException
{
log.info(username);
log.info(password.toString());
}
};
}
Thank you in advance:)
Metadata
Metadata
Assignees
Labels
No labels