One Of the Main Theme Of Spring And Its Various projects is: Closed For Modification and Open For Extension But while working with Spring Security on many projects I have faced a issue of absense of Protected getter for Private Fields Of Spring Security Classes With Are Extensible. For Example take the case of: 1. PersistentTokenBasedRememberMeServices 2. TokenBasedRememberMeServices These classes are extensible for method: protected boolean rememberMeRequested(HttpServletRequest request, String parameter) For some other strategy of Rember Me Requested may be by Header. Inside this method I want to use alwaysRemember which is private field in above two classes. But I can't because we don't have any Protected getter for it.

This is the case with many classes in Spring Security. This is blocker in above theme of Spring(Open Closed) which is also applicable to Spring Security.

The inelegant way of dealing with it is to redeclare the field in SubClass and proceed with extension.

Why don't we add Protected Getter in all these cases and avoid the boiler plate code of redeclaring the field in Sub Class.

Comment From: rwinch

Spring Security generally tries to encourage composition over inheritance. If you have a specific need, please describe that need (don't just say I want this to be protected but describe your end goal) and we will try and help you solve the problem.

Comment From: ankurpathak

@rwinch By Using Composition we can surely extend most of Spring classes. But I was just putting one Theme for future development of Spring Security. The idea is very clear if One Component is using some property or Other Component then 1. If we can provide those component and property by dependecy injection. 2. Then we shold have the way to insert and access those components and property by dependency injection in extended component(by inheritance or composition) without writing any boiler plate code. For Example: class A { private a; public setA(a){} }

class B : A { B(a) {super(a)} } But i don't have no way to access a in B.

class C{ private A aA; C(aA){aA=aA) } But i don't have no way to access a in C. But i need access to a to extend some functinality in C or B. Solution I have to write boiler plate code to store a in B and its wasting storage also.

Comment From: ankurpathak

@rwinch Take the case of RuntimeException in Java. It store message and cause. We make our custom exceptions by extending it or some by extending and composing it also. But we never declare cause and message in extended exceptions. We just pass them to parent exception and have way to acces them.

Comment From: rwinch

Generally the security team prefers composition, so unless you have a specific problem that cannot be solved with the current code, then there will not be any changes made.

Comment From: spring-projects-issues

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

Comment From: spring-projects-issues

Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.