spring-security

Set custom login url in Spring Security UsernamePasswordAuthenticationFilter JWT authentication

元气小坏坏 提交于 2020-08-21 05:34:08
问题 I'm following this auth0's tutorial to secure my application using JWT. I've ended up with the following WebSecurity configuration: @EnableWebSecurity @AllArgsConstructor(onConstructor = @__(@Autowired)) public class WebSecurity extends WebSecurityConfigurerAdapter { private final UserDetailsService userDetailsService; private final BCryptPasswordEncoder passwordEncoder; @Override protected void configure(HttpSecurity http) throws Exception { http.formLogin() .and().cors() .and().csrf()

@Order(SecurityProperties.ACCESS_OVERRIDE_ORDER) vs ManagementServerProperties.ACCESS_OVERRIDE_ORDER in Spring Security

久未见 提交于 2020-08-21 05:33:50
问题 Question1: In Spring Security, what exactly is the function @Order(SecurityProperties.ACCESS_OVERRIDE_ORDER) Spring Documentation States the below, but I am not sure I understand it clearly To override the access rules without changing any other autoconfigured features add a @Bean of type WebSecurityConfigurerAdapter with @Order(SecurityProperties.ACCESS_OVERRIDE_ORDER) . The ordering of various security features in Spring Security are as below as per my understanding (LowestValue i.e.

@Order(SecurityProperties.ACCESS_OVERRIDE_ORDER) vs ManagementServerProperties.ACCESS_OVERRIDE_ORDER in Spring Security

大城市里の小女人 提交于 2020-08-21 05:33:08
问题 Question1: In Spring Security, what exactly is the function @Order(SecurityProperties.ACCESS_OVERRIDE_ORDER) Spring Documentation States the below, but I am not sure I understand it clearly To override the access rules without changing any other autoconfigured features add a @Bean of type WebSecurityConfigurerAdapter with @Order(SecurityProperties.ACCESS_OVERRIDE_ORDER) . The ordering of various security features in Spring Security are as below as per my understanding (LowestValue i.e.

How can I display the current logged in User with Spring Boot Thymeleaf?

风格不统一 提交于 2020-08-19 12:18:40
问题 I am trying to display the details of the current user however I keep getting errors. I tried accessing the authenticated user from the template but that did not work as I was getting this error: Method getFirstName() cannot be found on org.springframework.security.core.userdetails.User type I was trying to get the information from a controller and then saving it in a string and passsing the string to a template but that wasn't working either. Here is my SecurityConfig class: @Configuration

How can I display the current logged in User with Spring Boot Thymeleaf?

与世无争的帅哥 提交于 2020-08-19 12:16:45
问题 I am trying to display the details of the current user however I keep getting errors. I tried accessing the authenticated user from the template but that did not work as I was getting this error: Method getFirstName() cannot be found on org.springframework.security.core.userdetails.User type I was trying to get the information from a controller and then saving it in a string and passsing the string to a template but that wasn't working either. Here is my SecurityConfig class: @Configuration

How do I use multiple 'JWK Set Uri' values in the same Spring Boot app?

大城市里の小女人 提交于 2020-08-17 03:53:12
问题 I have a requirement to use two different authorization servers (two Okta instances) to validate authentication tokens coming from two different web applications inside a single Spring Boot application which is a back-end REST API layer. Currently I have one resource server working with the following configuration: @Configuration @EnableWebSecurity public class ResourceServerSecurityConfig extends WebSecurityConfigurerAdapter { @Override protected void configure(HttpSecurity http) throws

How do I use multiple 'JWK Set Uri' values in the same Spring Boot app?

独自空忆成欢 提交于 2020-08-17 03:53:12
问题 I have a requirement to use two different authorization servers (two Okta instances) to validate authentication tokens coming from two different web applications inside a single Spring Boot application which is a back-end REST API layer. Currently I have one resource server working with the following configuration: @Configuration @EnableWebSecurity public class ResourceServerSecurityConfig extends WebSecurityConfigurerAdapter { @Override protected void configure(HttpSecurity http) throws

Revoke Oauth2 token without using Basic Auth

点点圈 提交于 2020-08-10 20:15:48
问题 I'm trying to implement the example from the book OAuth-2.0-Cookbook using Spring cloud OAuth2. I managed to implement his functionality but unfortunately I'm facing a problem: In order to make successful call I have to provide basic authentication credentials( Authorization: Basic YWRtaW46cXdlcnR5 ): @PostMapping("/oauth/revoke") public ResponseEntity<String> revoke(@RequestParam Map<String, String> params) { RevocationService revocationService = revocationServiceFactory .create(params.get(

Revoke Oauth2 token without using Basic Auth

余生颓废 提交于 2020-08-10 20:15:29
问题 I'm trying to implement the example from the book OAuth-2.0-Cookbook using Spring cloud OAuth2. I managed to implement his functionality but unfortunately I'm facing a problem: In order to make successful call I have to provide basic authentication credentials( Authorization: Basic YWRtaW46cXdlcnR5 ): @PostMapping("/oauth/revoke") public ResponseEntity<String> revoke(@RequestParam Map<String, String> params) { RevocationService revocationService = revocationServiceFactory .create(params.get(

Spring Security OAuth2: Purge TokenStore

六眼飞鱼酱① 提交于 2020-08-05 19:29:18
问题 Is there any way to configure Spring Security OAuth2 so it automatically purge TokenStore? I want to remove the expired tokens from time to time. I've seen the InMemoryTokenStore code and it performs a flush every now and again. But JdbcTokenStore does not perform any purge, so Who is in charge of removing the expried tokens from the storage? I've implemented a TokenStore that uses MongoDB as storage, but I have the same problem. Nobody is removing the expired tokens from the storage. 回答1: