As part of authenticate(), I had long ago added some additional functionality that allowed me to add information into the my own Principle. Right now I am trying to access a person's ipaddress as part of that authenticate so that I can add it to the database when they login. Only problem is that the HttpRequest is not available to the authenticate().
I recognize I can alter the library code, but I was hoping not to have to do so. Any ideas on how to do this?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
If you use FlexibleRealmInterface for your Realm, you will have access to the entire HttpServletRequest. This requires you to get the SF source from CVS and build it yourself (which isn't a big deal, really).
Since authenticate() returns a Principal, you can add anything you want to it.
Hope that helps,
-chris
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I ended up using Chris' solution. I think it was an excellent way of handling trying to work with the request and it seems to work with some initial tests. It would really be great if we had minor 2.1 release for that and the other changes I noticed in the release notes. It would also be great to have the result placed in a maven library for auto-download.
Thanks,
John
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
There's actually a loose plan for a 2.1 release that will (of course) include everything so far, plus one more feature or two.
After that, I think its time for a new major version with a (nearly) complete re-write of the architecture. It's currently pretty monolithic, and therefore difficult to add features or independently test certain components.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
As part of authenticate(), I had long ago added some additional functionality that allowed me to add information into the my own Principle. Right now I am trying to access a person's ipaddress as part of that authenticate so that I can add it to the database when they login. Only problem is that the HttpRequest is not available to the authenticate().
I recognize I can alter the library code, but I was hoping not to have to do so. Any ideas on how to do this?
You could setup a filter that stores all required info into a static ThreadLocal.
Next you can access this info anytime.
Koen
If you use FlexibleRealmInterface for your Realm, you will have access to the entire HttpServletRequest. This requires you to get the SF source from CVS and build it yourself (which isn't a big deal, really).
Since authenticate() returns a Principal, you can add anything you want to it.
Hope that helps,
-chris
Thanks Both.
I ended up using Chris' solution. I think it was an excellent way of handling trying to work with the request and it seems to work with some initial tests. It would really be great if we had minor 2.1 release for that and the other changes I noticed in the release notes. It would also be great to have the result placed in a maven library for auto-download.
Thanks,
John
There's actually a loose plan for a 2.1 release that will (of course) include everything so far, plus one more feature or two.
After that, I think its time for a new major version with a (nearly) complete re-write of the architecture. It's currently pretty monolithic, and therefore difficult to add features or independently test certain components.