Configure DefaultMethodSecurityExpressionHandler using Spring Security Java Config -


i trying use role hierarchy feature provided spring security in spring boot application , found problems java config.

in application, i've globalmethodsecurity enabled in order use @preauthorize annotations. because of that, need in order use role hierarchy support create new instance of defaultmethodsecurityexpressionhandler , set instance of rolehierarchyimpl instance configuration want (the role hierarchy itself).

although, if try using websecurityconfigureradapter , configure(httpsecurity http) method, i'm not able because .expressionhandler() expecting securityexpressionhandler<filterinvocation> , defaultmethodsecurityexpressionhandler securityexpressionhandler<methodinvocation>.

in order solve problem, found out solution create subclass of globalmethodsecurityconfiguration , override method creating expressionhandler bean it's described in docs

globalmethodsecurityconfiguration - spring security docs

by saying this, i'm wondering if .expressionhandler() method shouldn't allow configuration. if not, maybe reference in javadoc pointing globalmethodsecurityconfiguration useful.

after this, think idea of websecurityconfigureradapter , .expressionhandler applied security applied based on filter of http request , isn't supposed applied @ method level, opinions , advices welcome confirm i'm doing it's supposed.


Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -