use of de.metas.ui.web.session.UserSession in project metasfresh-webui-api by metasfresh.
the class ServletLoggingFilter method extractLoggedUser.
private static final String extractLoggedUser(final HttpServletRequest httpRequest) {
try {
final UserSession userSession = UserSession.getCurrentOrNull();
if (userSession == null) {
return "_noSession";
}
final String userName = userSession.getUserName();
if (!userSession.isLoggedIn()) {
if (userName == null || userName.isEmpty()) {
return "_notLoggedIn";
} else {
return "_notLoggedInBut_" + userName;
}
} else if (userName == null || userName.isEmpty()) {
return "_unknown";
} else {
return userName;
}
} catch (final Exception e) {
e.printStackTrace();
return "_error";
}
}
Aggregations