Skip to content

Instantly share code, notes, and snippets.

@dapperAuteur
Created November 19, 2018 01:30
Show Gist options
  • Save dapperAuteur/9a9214359021b3ce612602f725ab841f to your computer and use it in GitHub Desktop.
Save dapperAuteur/9a9214359021b3ce612602f725ab841f to your computer and use it in GitHub Desktop.
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