Subversion Repositories SmartDukaan

Rev

Rev 30219 | Rev 30228 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
25976 amit.gupta 1
package com.spice.profitmandi.web.config;
2
 
3
import org.springframework.beans.factory.annotation.Autowired;
4
import org.springframework.context.annotation.Configuration;
5
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
6
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
26324 amit.gupta 7
import org.springframework.security.config.annotation.web.builders.WebSecurity;
25976 amit.gupta 8
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
9
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
10
 
11
@Configuration
12
@EnableWebSecurity
13
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
26310 amit.gupta 14
 
25976 amit.gupta 15
	@Autowired
16
	private MyBasicAuthenticationEntryPoint myBasicAuthenticationEntryPoint;
17
 
26324 amit.gupta 18
	@Override
25976 amit.gupta 19
	public void configure(WebSecurity web) throws Exception {
26547 amit.gupta 20
		web.ignoring().antMatchers("/resources/**").antMatchers("/spicemoney/callback");
26324 amit.gupta 21
	}
25976 amit.gupta 22
 
23
	@Override
24
	protected void configure(HttpSecurity http) throws Exception {
30039 tejbeer 25
		http.logout().logoutUrl("logmeout").and().cors().disable().csrf().disable().authorizeRequests()
26
				// .antMatchers("/**").hasRole("hdfc")
27
				.antMatchers("/hdfc/**").hasRole("hdfc").antMatchers("/imei/validate").hasRole("paytail")
28
				.antMatchers("/spicemoney/callback").hasRole("spicemoney").antMatchers("/hdfctest/**")
30227 tejbeer 29
				.hasRole("hdfctest").antMatchers("/fundfina/**").hasRole("fundfina").antMatchers("/**").permitAll()
30219 tejbeer 30
				.and().httpBasic().authenticationEntryPoint(myBasicAuthenticationEntryPoint);
25976 amit.gupta 31
	}
32
 
26310 amit.gupta 33
	@Autowired
34
	protected void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
35
		auth.inMemoryAuthentication().withUser("hdfcuser").password("sd123$%^aGg").roles("hdfc").and()
30039 tejbeer 36
				.withUser("hdfctestuser").password("test").roles("hdfctest").and().withUser("spicemoney")
37
				.password("$SMT123MONEY").roles("spicemoney").and().withUser("paytail").password("$SDP@yTa!l")
30219 tejbeer 38
				.roles("paytail").and().withUser("fundfina").password("$mart@234").roles("fundfina");
25976 amit.gupta 39
	}
40
 
41
}