*i used spring security 6 => @Bean public SecurityFilterChain securityFilterChain(HttpSecurity httpSecurity) throws Exception { return httpSecurity.cors(Customizer.withDefaults()) .csrf(csrf -> csrf.ignoringRequestMatchers("/api/home/**")) .authorizeHttpRequests(httpRequests ->{httpRequests.requestMatchers("api/home/welcome").hasRole("USER");httpRequests.anyRequest().authenticated();}) .sessionManagement(session -> session.sessionCreationPolicy(SessionCreationPolicy.STATELESS)) .oauth2ResourceServer(oauth2ResourceServer -> oauth2ResourceServer.jwt(Customizer.withDefaults())) .build(); } *app.properties => spring.security.oauth2.resourceserver.jwt.issuer-uri=http://localhost:8180/realms/oauth2-demo spring.security.oauth2.resourceserver.jwt.jwk-set-uri=http://localhost:8180/realms/oauth2-demo/protocol/openid-connect/certs

*angular=>i installed library called angular-oauth2-oidc the probleme is when i authenticate for a user the access token retieve successfuly but whrn i add role to this user and retry again the access token failed to retieve it

*angular=>i installed library called angular-oauth2-oidc the probleme is when i authenticate for a user the access token retieve successfuly but whrn i add role to this user and retry again the access token failed to retieve it

0

There are 0 best solutions below