-
Notifications
You must be signed in to change notification settings - Fork 6k
Add remember-me support for CAS #11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Thank you for your contribution. Overall I think the changes look pretty good. I do have some structural changes that I think we should make in order to clean things up a bit. Keep in mind I am open to constructive criticism on my suggestions as well.
Once again thank you for taking time to contribute back to the community. |
Thank you for taking time to review this pull request. I agree with the targeted version : 3.2.0, the commit message format and the need to squash all commits associated to the same JIRA. I read carefully SEC-1987 and I understand it : my changes looked like a bit a trick just for CAS and it's better to have a global solution for remember-me. Nonetheless, I think we can't remove all classes straight-forward. The problems I see :
When discarding all my changes to restart working on SEC-1987, I closed this pull request by mistake. So I will open a new one for changes regarding SEC-1987 and wait for your feedback. |
Thank you for your prompt and detailed response. No problem on the code formatting thing. In short, each module within Spring operates slightly differently. The lack of documentation is something that is my fault for not having well documented and my note was a work around for the problem. I have created SEC-1988 to formally address this problem.
|
I would definitely choose the second option : it's not too much change and well designed.
We can maybe get rid of the CasRememberMeAccessDeniedHandlerImpl class, but we can't remove the posibility to configure easily the need to re-authenticate if previously authenticated in CAS remember-me mode. It also depends on the UserDetailsService used, if it grants or not different roles according to the remember-me nature of the CAS authentication token. It must be a pretty unsual use case though. I guess that you don't like using the "access denied handler" concept as an entry point but right now, I don't see a better solution than a dedicated access denied handler for CAS remember-me feature. If we assume that the UserDetailsService bean grants roles without taking into account the remember-me nature of the CAS token, the problem is that at the ExceptionTranslationFilter level, I don't know which vote has failed to lead to access denied, if I was sure that a vote regarding "isFullyAuthenticated" or "isRemembered" has failed, I would be sure that a re-authentication is necessary for a CAS remember-me token. Sorry for being so long in my explanations.
|
No problem with the long explanations; they are necessary at times for effective collaboration :) I am still not convinced that CasRememberMeAccessDeniedHandlerImpl should be included. Perhaps it is because I am having trouble understanding a few of your points.
I'm not sure what you are getting at here is this related to the fact that you think that the CasRememberMeAccessDeniedHandlerImpl should be included? Is this just a general problem that you feel still needs to be solved?
Same comment as above. Keep in mind I am still very reluctant to include this feature but thought I would let you know some initial feedback on this. If we were to include CasRememberMeAccessDeniedHandlerImpl I would suggest a few changes.
|
To make things clearer, I tried to detail the use cases where the CasRememberMeAccessDeniedHandler is required if you use CAS authentication and remember-me mode, and therefore should be included in the Spring Security configuration of the element :
I don't see any better solution than this CasRememberMeAccessDeniedHandler, but as you look(ed) not convinced, I tried to give you as much information as possible to help you find maybe a better solution. That being said, a) About naming : I don't have any problem removing the Impl suffix. b) About logout, I copied and pasted what is done in the ExceptionTranslationFilter : put null in the Authentication in the security context + save request + call the commence method of the entry point. You told me about using the real logout handler. I think that it's not a good idea : logout destroys web session and in this case (being in CAS remember-me mode and wanting to re-authenticate at CAS server), the user session should not be destroyed (the user should not lose data in its web session) but security information should be overriden by new ones provided by the new authentication. I think that I should just save the request + call the commence method of the entry point. c) About the renew parameter and the copy mechanism, you're right : that's ugly and not really working if there is some inheritance (I won't be able to make a complete copy of the objects). I would propose a better solution :
|
Why don't I take a look at what you have with the proposed changes. Can you post the code with your updated changes? Perhaps at that I will see it more your way. If not, we can continue the discussion from there. |
Here we go : I committed all changes and sent pull request #14. I messed up again with git in squashing properly commits that's why pull request #12 was closed. I'm pretty happy with the results : it looks well designed and well integrated in Spring Security. I followed at best what we agreed upon and what I proposed. I did realize my first proposal has a bug as the isRememberMe() method was acting like the isAuthenticated() method. I added several unit tests and two integration tests you can call with : gradlew spring-security-samples-cassample:integrationTest. I'm looking forward to your feedback. |
For SEC-1986.
I have signed and agree to the terms of the SpringSource Individual Contributor License Agreement.