Created
November 19, 2018 01:30
-
-
Save dapperAuteur/9a9214359021b3ce612602f725ab841f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.awews; | |
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.context.annotation.Configuration; | |
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; | |
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; | |
import org.springframework.security.config.annotation.web.builders.HttpSecurity; | |
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; | |
import com.awews.person.User; | |
@Configuration | |
@EnableWebSecurity | |
@EnableGlobalMethodSecurity(prePostEnabled = true) | |
public class SecurityConfiguration { | |
@Autowired | |
private SpringDataJpaUserDetailsService userDetailsService; | |
// @Override | |
protected void configure(AuthenticationManagerBuilder auth) throws Exception { | |
auth | |
.userDetailsService(this.userDetailsService) | |
.passwordEncoder(User.PASSWORD_ENCODER); | |
} | |
// @Override | |
protected void configure(HttpSecurity http) throws Exception { | |
http | |
.requestMatchers() | |
.antMatchers("/api/ver0001/**") | |
.and() | |
// .authorizeRequests() | |
// .antMatchers("/").permitAll() | |
// .anyRequest().authenticated() | |
// .and() | |
// .formLogin() | |
// .defaultSuccessUrl("/", true) | |
// .permitAll() | |
// .and() | |
.httpBasic() | |
.and() | |
.csrf().disable() | |
.logout() | |
.logoutSuccessUrl("/"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment