I am trying to extract Username field from a Session Atribute. The Username is APP1000, I am trying whith RegExp but I dont get it:
"org.springframework.security.core.context.SecurityContextImpl@b03d8ffe: Authentication: org.springframework.security.authentication.UsernamePasswordAuthenticationToken@b03d8ffe: Principal: org.springframework.security.core.userdetails.User@b03d3ca6: Username: APP10000; Password: [PROTECTED]; Enabled: true; AccountNonExpired: true; credentialsNonExpired: true; AccountNonLocked: true; Not granted any authorities; Credentials: [PROTECTED]; Authenticated: true; Details: org.springframework.security.web.authentication.WebAuthenticationDetails@ffff4c9c: RemoteIpAddress: 184.108.40.206; SessionId: c4OjFbX2lWGx6Q42eUKuTXn; Not granted any authorities"
Could you help me?
You may want to consider this one:
which is more specific than the one mentioned above and therefore executes a bit more efficiently. According to the regex utility "regex101.com", it will execute and return your match in about 30 steps, as opposed to about 2449 steps for the one above.
the Session Attribute field is named SECURITY_CONTEXT, so I have configured the measure as Session Attribute. Session Attribute: SECURITY_CONTEXT match regex ; Questions:
1- Value: Should I put again SECURITY_CONTEXT¿?. ,
2- Transformatioj regex, this one Username: ([^;]*)?
I suppose this is wrong because I cannot see yet tagged visits.
Thanks in advance.
Let's go one step at a time. First thing to do is to make sure you are capturing the Session Attribute. You do this by configuring the properties of the Servlet Sensor. This will take effect immediately.
Once this is done, the next thing is to find a PurePath that you know will have this SECURITY_CONTEXT attribute. Right-click on the PurePath tree and look at the Details. You should see that attribute captured on the PurePath.
Once you see the attribute being captured on your PurePaths, then you can troubleshoot your measure definition if it is not working. The way you've described it (creating the measure, with the transformation regex) looks right (at least at the high level). If it's not working, perhaps you can include a screen shot of the definition.
In the "Match" field you do not want "regex". Please leave it as it defaulted, which is "contains", and leave the Value field blank. That will work fine. What that means is that you don't care what's in the Value - you will match anything. Then you apply the Transformation RegEx to that, which will pull out your user name. 🙂