In order to have more control over (anonymous) users, the question arises to have some more userinfo. It would be nice to extend the session object to contain also:
The advantage is that in a microflow, these attributes are available via the $currentSession variable.
This enables for example to write audit logs with IP, collect statistics about user agents and distinguish multiple domain names.
I have implemented the java action that Johan Flikweert created. But, while running my application locally, it returns the IP Address 127.0.0.1 which is the loopback address (also known as localhost).It’s different from my IPv4 Address. I used IPConfig to get my IP, & it was completely different.
Any ideas if I’m missing something?!
I built the Http Commons Module as an easy way to access all these new fields in Java.
Yes, I've built a Java Action to retrieve the client's IP address (having input parameter: ISession):
// BEGIN USER CODE
IContext ctx = SessionParameter1.getContext();
Optional<IMxRuntimeRequest> orr = ctx.getRuntimeRequest();
String realIP = null;
if (orr.isPresent()) {
IMxRuntimeRequest rr = orr.get();
realIP = rr.getHeader("X-Real-IP");
if( realIP == null )
realIP = rr.getHeader("X-Forwarded-For");
if( realIP == null )
realIP = rr.getRemoteAddr();
}
return realIP;
// END USER CODE
Has anyone built this Java action already and can share it?
I would like to add extra fields to that list detectable from the browser
For styling purposes: