Created
February 2, 2015 19:51
-
-
Save novoj/5f09bdc1164fbca77c21 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Quiz: | |
Try to replace request.getRequestURI() in #commence method with custom value retrieved from request attribute: | |
org.springframework.security.web.access.channel.RetryWithHttpsEntryPoint | |
org.springframework.security.web.access.channel.RetryWithHttpEntryPoint | |
Try to override org.springframework.security.web.DefaultRedirectStrategy, but reuse complex logic in org.springframework.security.web.DefaultRedirectStrategy#calculateRedirectUrl |
Remember proper encapsulation is important to keep code complexity down to a minimum. In general, Spring Security favors composition over inheritance. For this reason, you will not find a lot of hooks via protected methods. This is especially true in implementations of interfaces with only a single method.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I know that I could implement my own implementation of the interface if neccessary. Interfaces are well designed.
But my aim is not to replace default implementation that is battle tested on many installations and patched by community. I just want to alter existing logic slightly to serve my purpose (my exceptional case if you will) and everything else left in place as it is.
This approach have served me well since year 2007 when I started with Acegi Security (I believe there are still some working tweaks in code that I made several years ago).
So unlocking some properties to protected mode, or spliting complex methods to several smaller ones with protected access would help a lot in this case.
When I work with (and need to extend) Spring Framework - core, there are usually ways how to hack-in relatively easily.
Btw. my solution to Entry points was: