We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I read https://www.baeldung.com/spring-security-oauth2-authentication-with-reddit in order to understand how to implement OAuth in a legacy Spring (no Boot, Spring Security 4.x) web application but seems like the code doesn't match the article.
esp.
@Configuration @EnableWebSecurity public class SecurityConfig extends WebSecurityConfigurerAdapter { /* ... */ @Override protected void configure(HttpSecurity http) throws Exception { http .anonymous().disable() .csrf().disable() .authorizeRequests() .antMatchers("/home.html").hasRole("USER") .and() .httpBasic() .authenticationEntryPoint(oauth2AuthenticationEntryPoint()); } private LoginUrlAuthenticationEntryPoint oauth2AuthenticationEntryPoint() { return new LoginUrlAuthenticationEntryPoint("/login"); } }
which makes use of .authenticationEntryPoint() method + a LoginUrlAuthenticationEntryPoint object,
.authenticationEntryPoint()
LoginUrlAuthenticationEntryPoint
while https://github.com/Baeldung/reddit-app/blob/master/reddit-web/src/main/java/org/baeldung/config/web/GeneralSecurityConfig.java
@Configuration @EnableWebSecurity @ComponentScan({ "org.baeldung.security" }) public class GeneralSecurityConfig extends WebSecurityConfigurerAdapter { /* ... */ @Override protected void configure(final HttpSecurity http) throws Exception { // @formatter:off http.anonymous().disable().csrf().disable().authorizeRequests() .antMatchers("/api/*","/feedForm","/profile","/scheduledPosts","/feeds","/changePassword","/updatePassword").authenticated() .antMatchers("/adminHome","/users").hasAuthority("USER_READ_PRIVILEGE") .and() .formLogin().loginPage("/").loginProcessingUrl("/j_spring_security_check").defaultSuccessUrl("/home") .failureUrl("/?error").usernameParameter("username").passwordParameter("password") .successHandler(successHandler) .and() .logout().invalidateHttpSession(true).deleteCookies("JSESSIONID").logoutUrl("/logout").logoutSuccessUrl("/") .and() .sessionManagement().sessionFixation().none().maximumSessions(1).maxSessionsPreventsLogin(true); // @formatter:on } }
calls .formLogin() loginPage() failureUrl() and so on...
.formLogin()
loginPage()
failureUrl()
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I read https://www.baeldung.com/spring-security-oauth2-authentication-with-reddit in order to understand how to implement OAuth in a legacy Spring (no Boot, Spring Security 4.x) web application but seems like the code doesn't match the article.
esp.
which makes use of
.authenticationEntryPoint()
method + aLoginUrlAuthenticationEntryPoint
object,while https://github.com/Baeldung/reddit-app/blob/master/reddit-web/src/main/java/org/baeldung/config/web/GeneralSecurityConfig.java
calls
.formLogin()
loginPage()
failureUrl()
and so on...The text was updated successfully, but these errors were encountered: