package com.huixinpn.dionysus;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpMethod;
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.builders.WebSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.crypto.password.PasswordEncoder;

import com.huixinpn.dionysus.auth.DionysusUserDetailsService;

@Configuration
@EnableWebSecurity
@EnableGlobalMethodSecurity(securedEnabled = true)
public class WebSecurityConfiguration extends WebSecurityConfigurerAdapter {

	@Autowired
	@Qualifier("dionysus")
	private DionysusUserDetailsService securityUserService;
	
	@Autowired
	private PasswordEncoder encoder;
	
	@Override
	protected void configure(AuthenticationManagerBuilder auth) throws Exception {
		auth.userDetailsService(securityUserService).passwordEncoder(encoder);
	}
	
	@Override
	protected void configure(HttpSecurity http) throws Exception {
		http.csrf().disable();
//	    http.authorizeRequests()
//            .antMatchers("/api/v1/admin/**", "/admin/**")
//            .access("hasRole('ROLE_ADMIN')")
//          .and()
//            .formLogin()
//            .loginPage("/login")
//            .failureUrl("/login?error")
//			.usernameParameter("username")
//			.passwordParameter("password")
//		  .and()
//		  	.logout()
//		  	.logoutSuccessUrl("/login?logout");
	}
	
	@Override
	public void configure(WebSecurity web) throws Exception {
		web.ignoring()
			.antMatchers(HttpMethod.POST, "/api/v1/login")
			.antMatchers(HttpMethod.GET, "/", 
				"/themes/**", "/public/**", 
				"/styles/**", "/fonts/**", "/images/**", "/scripts/**");
	}
}
@@ -25,16 +25,66 @@
 nysus;%0A%0A
+import com.huixinpn.dionysus.service.UserService;%0A
 import o
@@ -142,71 +142,8 @@
 ed;%0A
-import org.springframework.beans.factory.annotation.Qualifier;%0A
 impo
@@ -882,71 +882,8 @@
 r;%0A%0A
-import com.huixinpn.dionysus.auth.DionysusUserDetailsService;%0A%0A
 @Con
@@ -1058,59 +1058,20 @@
 ed%0A%09
-@Qualifier(%22dionysus%22)%0A%09private DionysusUserDetails
+private User
 Serv

build break fixing