| 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/**")
|
|
|
29 |
.hasRole("hdfctest").antMatchers("/**").permitAll().and().httpBasic()
|
| 26310 |
amit.gupta |
30 |
.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")
|
|
|
38 |
.roles("paytail");
|
| 25976 |
amit.gupta |
39 |
}
|
|
|
40 |
|
|
|
41 |
}
|