|
|
@@ -4,8 +4,9 @@ import com.ningdatech.basic.util.NdJsonUtil; |
|
|
|
import com.ningdatech.basic.util.StrPool; |
|
|
|
import com.ningdatech.pmapi.common.constant.BizConst; |
|
|
|
import com.ningdatech.pmapi.common.constant.CommonConst; |
|
|
|
import com.ningdatech.pmapi.user.security.auth.handler.DefaultExpiredSessionStrategy; |
|
|
|
import com.ningdatech.pmapi.user.security.auth.agent.AgentAuthSecurityConfig; |
|
|
|
import com.ningdatech.pmapi.user.security.auth.credential.CredentialAuthSecurityConfig; |
|
|
|
import com.ningdatech.pmapi.user.security.auth.handler.DefaultExpiredSessionStrategy; |
|
|
|
import org.springframework.beans.factory.annotation.Qualifier; |
|
|
|
import org.springframework.context.annotation.Configuration; |
|
|
|
import org.springframework.http.HttpStatus; |
|
|
@@ -31,13 +32,16 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter { |
|
|
|
private final CredentialAuthSecurityConfig credentialAuthSecurityConfig; |
|
|
|
private final LogoutSuccessHandler logoutSuccessHandler; |
|
|
|
private final DefaultExpiredSessionStrategy defaultExpiredSessionStrategy; |
|
|
|
private final AgentAuthSecurityConfig agentAuthSecurityConfig; |
|
|
|
|
|
|
|
public WebSecurityConfig(AuthProperties authProperties, |
|
|
|
CredentialAuthSecurityConfig credentialAuthSecurityConfig, |
|
|
|
AgentAuthSecurityConfig agentAuthSecurityConfig, |
|
|
|
@Qualifier(value = "defaultLogoutSuccessHandler") LogoutSuccessHandler logoutSuccessHandler, |
|
|
|
DefaultExpiredSessionStrategy defaultExpiredSessionStrategy) { |
|
|
|
this.authProperties = authProperties; |
|
|
|
this.credentialAuthSecurityConfig = credentialAuthSecurityConfig; |
|
|
|
this.agentAuthSecurityConfig = agentAuthSecurityConfig; |
|
|
|
this.logoutSuccessHandler = logoutSuccessHandler; |
|
|
|
this.defaultExpiredSessionStrategy = defaultExpiredSessionStrategy; |
|
|
|
} |
|
|
@@ -47,7 +51,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter { |
|
|
|
assemblerPreAuthUrls(http); |
|
|
|
http.formLogin() |
|
|
|
.loginPage(authProperties.getAuthRequireUrl()) |
|
|
|
.and().apply(credentialAuthSecurityConfig) |
|
|
|
.and().apply(credentialAuthSecurityConfig).and().apply(agentAuthSecurityConfig) |
|
|
|
.and() |
|
|
|
.authorizeRequests().antMatchers(authProperties.getIgnoreAuthUrlsArray()).permitAll().anyRequest() |
|
|
|
.authenticated().and() |
|
|
|