diff options
author | Vitaly Takmazov | 2024-12-19 19:10:11 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2024-12-19 19:10:11 +0300 |
commit | 5255efe2e8e7990d02c6db64e56a80b57fb1a6ff (patch) | |
tree | dda394ec2241ae8944ec736fa0a034bf4ddfb098 | |
parent | 6e2a7c7e3deb3c0f408d18246d6699f68354c65e (diff) |
api: do not use authentication realm header
-rw-r--r-- | src/main/java/com/juick/config/SecurityConfig.java | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/main/java/com/juick/config/SecurityConfig.java b/src/main/java/com/juick/config/SecurityConfig.java index 6608a658a..7e37b7d8e 100644 --- a/src/main/java/com/juick/config/SecurityConfig.java +++ b/src/main/java/com/juick/config/SecurityConfig.java @@ -35,6 +35,7 @@ import org.springframework.context.annotation.Configuration; import org.springframework.core.Ordered; import org.springframework.core.annotation.Order; import org.springframework.http.HttpMethod; +import org.springframework.http.HttpStatus; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.security.config.Customizer; import org.springframework.security.config.annotation.web.builders.HttpSecurity; @@ -52,10 +53,10 @@ import org.springframework.security.oauth2.server.authorization.settings.Authori import org.springframework.security.web.AuthenticationEntryPoint; import org.springframework.security.web.SecurityFilterChain; import org.springframework.security.web.authentication.AuthenticationSuccessHandler; +import org.springframework.security.web.authentication.HttpStatusEntryPoint; import org.springframework.security.web.authentication.RememberMeServices; import org.springframework.security.web.authentication.SavedRequestAwareAuthenticationSuccessHandler; import org.springframework.security.web.authentication.rememberme.TokenBasedRememberMeServices; -import org.springframework.security.web.authentication.www.BasicAuthenticationEntryPoint; import org.springframework.security.web.authentication.www.BasicAuthenticationFilter; import org.springframework.security.web.util.matcher.AntPathRequestMatcher; import org.springframework.web.cors.CorsConfiguration; @@ -115,9 +116,7 @@ public class SecurityConfig { @Bean AuthenticationEntryPoint apiAuthenticationEntryPoint() { - var entryPoint = new BasicAuthenticationEntryPoint(); - entryPoint.setRealmName("Juick"); - return entryPoint; + return new HttpStatusEntryPoint(HttpStatus.UNAUTHORIZED); } @Value("${auth_remember_me_key:secret}") |