Rev 30227 | Go to most recent revision | View as "text/plain" | Blame | Compare with Previous | Last modification | View Log | RSS feed
package com.spice.profitmandi.web.config;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.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;@Configuration@EnableWebSecuritypublic class WebSecurityConfig extends WebSecurityConfigurerAdapter {@Autowiredprivate MyBasicAuthenticationEntryPoint myBasicAuthenticationEntryPoint;@Overridepublic void configure(WebSecurity web) throws Exception {web.ignoring().antMatchers("/resources/**").antMatchers("/spicemoney/callback");}@Overrideprotected void configure(HttpSecurity http) throws Exception {http.logout().logoutUrl("logmeout").and().cors().disable().csrf().disable().authorizeRequests()// .antMatchers("/**").hasRole("hdfc").antMatchers("/hdfc/**").hasRole("hdfc").antMatchers("/imei/validate").hasRole("paytail").antMatchers("/spicemoney/callback").hasRole("spicemoney").antMatchers("/hdfctest/**").hasRole("hdfctest").antMatchers("/**").permitAll().and().httpBasic().authenticationEntryPoint(myBasicAuthenticationEntryPoint);}@Autowiredprotected void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {auth.inMemoryAuthentication().withUser("hdfcuser").password("sd123$%^aGg").roles("hdfc").and().withUser("hdfctestuser").password("test").roles("hdfctest").and().withUser("spicemoney").password("$SMT123MONEY").roles("spicemoney").and().withUser("paytail").password("$SDP@yTa!l").roles("paytail");}}