spring


Spring Security Filter is not being triggered by configuration


I am configuring the security of my REST and I don't know how I can secure my methods, however allowing a filter to trigger to set my Authority
http
.authorizeRequests()
.antMatchers(PERSISTENCE_SERVICE_URL)
.hasAuthority(AUTHORITY_PERSISTENCE_SERVICE)
.and()
.csrf()
.disable();
And in my Filter which extends OncePerRequestFilter does something like this
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException {
this.authenticationImpl.init();
String jwt = request.getHeader("jwt");
String refresh = request.getHeader("refresh");
if(jwt != null) {
this.jwtPropertyExtractor.commitJwt(jwt, refresh);
String jwtId = this.jwtPropertyExtractor.getIdentityId();
String securityRole = this.jwtPropertyExtractor.getSecurityRole();
this.authenticationImpl.setIdentityId(jwtId);
this.authenticationImpl.updateSecurityRole(securityRole);
SecurityContextHolder.getContext().setAuthentication(this.authenticationImpl);
}
filterChain.doFilter(request, response); }
So when I place .hasAuthority(AUTHORITY_PERSISTENCE_SERVICE) in my configuration, my filter is not even being triggered but i need him to set my authentication.
Ok i added
.addFilterBefore(jwtAuthorisationFilter(),
BasicAuthenticationFilter.class);
}
#Bean
public JwtAuthorisationFilter jwtAuthorisationFilter() {
return new JwtAuthorisationFilter(jwtExtractor(),
authenticationImpl());
}
Now its working fine thx for that hint :>

Related Links

spring addResourceHandler for text files
Extremely long exceptions logs in Spring Boot
Can't get spring-boot /health indicator to display full content
Always invalid username and password in Spring Security Oauth2
Access to Microservices via Eureka Server
How spring community manages version of the framework
Can I force refresh content/page using Spring Boot and JSP?
spring cloud dataflow source file | sink gpfdist speed?
Spring LdapTemplate - is ldap reachable?
Spring MVC to REST
Unexpected and unwanted div element in return from Spring RestController
issue while calling soap service using spring webservicetemplate
Spring cacheable force refresh
Unable to start Pivotal tc Server in Spring tool Suite
spring boot social facebook throws NPE
How to create servlet-context.xml & servlet-context-dispatcher.xml files for spring

Categories

HOME
arrays
json
ssas-2012
erlang
answer-set-programming
payment-gateway
shopify
ipython
antivirus
survival-analysis
appmaker
propertygrid
branch.io
sequelize.js
proguard
requirejs
diagram
x11
gwtp
datagrip
netezza
r-lavaan
apache-karaf
tree-traversal
plupload
deb
countif
go-cd
spring-test
jflex
nesc
bitcoin-testnet
dd-wrt
blackboard
websauna
red-black-tree
xor
encase
helix-3d-toolkit
backup-strategies
graph-databases
hawtio
mapguide
superpowered
pmwiki
discord.net
jquery-multidatespicker
infusionsoft
soundjs
wsadmin
bing-translator-api
spring-bean
startapp
livefyre
multi-agent
rhel6
slidesjs
pycurl
search-box
uicollectionviewlayout
qos
emgu
objloader
atlassian-crowd
android-navigationview
cjson
cfeclipse
c64
activeweb
pydio
cron-task
multiple-file-upload
database-backups
mongoskin
uwp-maps
dac
post-processing
xmp
acm
void
schtasks.exe
vips
site-prism
apigee-baas
on-duplicate-key
viper-architecture
gray-code
isml
hiera
jython-2.7
start-job
lexicographic
scala-2.11
mfmailcomposeviewcontroll
alertifyjs
httpcontext
help-viewer
winrt-httpclient
driver-signing
ng-hide
va-list
cgimageref
database-permissions
client-library
awesomeprint
process-monitor
vt100
css-tables
n-layer
z-machine
nintendo
wchar
gtk2hs
nvelocity
libavformat
loadui
sitemappath
clients
scala-2.8
graniteds
asp.net-mvc-controller
inline-if
database-diagramming
usergroups

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App