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

Neutralization of Script-Related HTML Tags in Java (Basic XSS)
Can I populate the default spring security schema through import.sql?
spring security oauth2 manually generate authcode
Spring Rest Hibernate Update List with PUT method
Spring - NoSuchMethodException when calling a RestService
download Document object using spring mvc without jsp
Spring security schema does not implement NameSpaceHandler
Spring context initializtion failed
How do I use Spring Security OAUTH to secure REST API?
Hibernate and Spring DataJPA can not handle Oracle table name with special character?
Spring Data JPA Specifications Distinct Query
spring 4 security jars are missing for offline download
I update avatar image and display it but the avatar does not change in Spring Boot , why?
MongoTemplate Query.addCriteria gives NoSuchMethodError
Get Join Table Data using Hibernate
deploy spring-boot jar to nexus

Categories

HOME
json
sidekiq
numpy
ibm-watson-cognitive
signalr
sed
freepascal
jasmine
mainframe
couchdb-2.0
apache2
laravel-4
value
filter
simpy
nodemailer
codeblocks
i2c
octopus-deploy
dropbear
packer
criteria
gatsby
symfony2-easyadmin
eclipse-luna
scaling
grub2
chocolatey
distance
qsub
http-method
pipelinedb
spring-data-neo4j
classpath
chrome-native-messaging
mayavi
nesc
smart-mobile-studio
skygear
data-extraction
pycparser
phpspreadsheet
rhel.net
zero
elfinder
finite-element-analysis
jdbi
resuming-training
z3py
onmouseover
aqgridview
range-v3
ti-basic
bnd
slidesjs
google-maps-ios
android-bitmap
info
pycurl
static-code-analysis
collapsingtoolbarlayout
emoticons
redux-router
cleditor
alter
xib
uistackview
mongoose-populate
aescryptoserviceprovider
git-annex
gmsmapview
aerogear
license-key
hornetq
registrykey
sparse-file
ember-cli-addons
robocode
musl
ultrawingrid
iostream
facebook-wall
colt
delphi-xe3
crystal-reports-10
nimrod
html-form-post
grunt-contrib-compass
database-permissions
vt100
transitive-closure-table
n-layer
static-variables
gdt
objective-c-protocol
selectonemenu
text-size
galaxy-tab
adsl
chdatastructures
winverifytrust
asp.net-mvc-controller
swfloader
economics
hardware-infrastructure

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