提交 809c02c4 编写于 作者: sq3536's avatar sq3536

zuul劫持登录到uaa-api

上级 3aa8980a
......@@ -34,9 +34,6 @@ public class ${app.getPKGCodeName()}SecurityConfig extends WebSecurityConfigurer
private AuthenticationEntryPoint unauthorizedHandler;
@Autowired
<#if sys.getPSSystemSetting()?? && sys.getPSSystemSetting().getDataAccCtrlArch()?? && sys.getPSSystemSetting().getDataAccCtrlArch()==1>
@Qualifier("IBZUAAUserService")
</#if>
private AuthenticationUserService userDetailsService;
/**
......
......@@ -46,6 +46,12 @@ zuul:
serviceId: ibzwf-api
stripPrefix: true
</#if>
<#if sys.getPSSystemSetting()?? && sys.getPSSystemSetting().getDataAccCtrlArch()?? && sys.getPSSystemSetting().getDataAccCtrlArch()==1>
loginv7:
path: /v7/login
serviceId: ibzuaa-api
stripPrefix: false
</#if>
<#comment>通过设置该参数,避免Zuul转发请求时丢失Authorization请求头信息</#comment>
sensitive-headers:
- Cookie,Set-Cookie,Authorization
......
......@@ -33,9 +33,6 @@ public class DevBootSecurityConfig extends WebSecurityConfigurerAdapter {
private AuthenticationEntryPoint unauthorizedHandler;
@Autowired
<#if sys.getPSSystemSetting()?? && sys.getPSSystemSetting().getDataAccCtrlArch()?? && sys.getPSSystemSetting().getDataAccCtrlArch()==1>
@Qualifier("IBZUAAUserService")
</#if>
private AuthenticationUserService userDetailsService;
/**
......
......@@ -17,11 +17,11 @@ server:
zuul:
routes:
<#assign haswfentity=false>
<#list item.getAllPSAppDataEntities() as appDataEntity>
<#list item.getAllPSDataEntities() as appDataEntity>
<#assign serviceId="">
<#assign serviceUrl=srfpluralize(appDataEntity.codeName?lower_case)>
<#assign appEntity=appDataEntity.name?lower_case>
<#assign psDataEntity=appDataEntity.getPSDataEntity()>
<#assign psDataEntity=appDataEntity>
<#assign systemName=sys.getCodeName()?lower_case>
<#if psDataEntity.hasPSDEWF()??>
<#assign haswfentity=true>
......@@ -30,10 +30,12 @@ zuul:
<#comment>serviceApi模式</#comment>
<#assign serviceId=(psDataEntity.getPSSubSysServiceAPI().getServiceCodeName())!''>
<#assign serviceUrl=srfpluralize(appDataEntity.name?lower_case)>
<#if serviceId!="">
${appEntity}:
path: /${serviceUrl}/**
serviceId: ${serviceId}
stripPrefix: false
</#if>
</#if>
</#list>
<#if haswfentity==true>
......@@ -42,6 +44,12 @@ zuul:
serviceId: ibzwf-api
stripPrefix: false
</#if>
<#if sys.getPSSystemSetting()?? && sys.getPSSystemSetting().getDataAccCtrlArch()?? && sys.getPSSystemSetting().getDataAccCtrlArch()==1>
loginv7:
path: /v7/login
serviceId: ibzuaa-api
stripPrefix: false
</#if>
<#comment>通过设置该参数,避免Zuul转发请求时丢失Authorization请求头信息</#comment>
sensitive-headers:
- Cookie,Set-Cookie,Authorization
......
......@@ -34,9 +34,6 @@ public class ${item.codeName}SecurityConfig extends WebSecurityConfigurerAdapter
private AuthenticationEntryPoint unauthorizedHandler;
@Autowired
<#if sys.getPSSystemSetting()?? && sys.getPSSystemSetting().getDataAccCtrlArch()?? && sys.getPSSystemSetting().getDataAccCtrlArch()==1>
@Qualifier("IBZUAAUserService")
</#if>
private AuthenticationUserService userDetailsService;
/**
......
......@@ -18,9 +18,11 @@ import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
@RestController
@RequestMapping("/")
@ConditionalOnProperty( name = "ibiz.enablePermissionValid", havingValue = "false")
public class AuthenticationController
{
......@@ -31,9 +33,6 @@ public class AuthenticationController
private AuthTokenUtil jwtTokenUtil;
@Autowired
<#if sys.getPSSystemSetting()?? && sys.getPSSystemSetting().getDataAccCtrlArch()?? && sys.getPSSystemSetting().getDataAccCtrlArch()==1>
@Qualifier("IBZUAAUserService")
</#if>
private AuthenticationUserService userDetailsService;
@PostMapping(value = ${r'"${ibiz.auth.path:v7/login}"'})
......
......@@ -30,7 +30,7 @@ public class AuthorizationTokenFilter extends OncePerRequestFilter {
private final AuthTokenUtil authTokenUtil;
private final String tokenHeader;
public AuthorizationTokenFilter(<#if sys.getPSSystemSetting()?? && sys.getPSSystemSetting().getDataAccCtrlArch()?? && sys.getPSSystemSetting().getDataAccCtrlArch()==1>@Qualifier("IBZUAAUserService")</#if> AuthenticationUserService userDetailsService, AuthTokenUtil authTokenUtil, @Value(${r'"${ibiz.jwt.header:Authorization}"'}) String tokenHeader) {
public AuthorizationTokenFilter(AuthenticationUserService userDetailsService, AuthTokenUtil authTokenUtil, @Value(${r'"${ibiz.jwt.header:Authorization}"'}) String tokenHeader) {
this.userDetailsService = userDetailsService;
this.authTokenUtil = authTokenUtil;
this.tokenHeader = tokenHeader;
......
......@@ -15,11 +15,13 @@ import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Service;
import org.springframework.util.DigestUtils;
import org.springframework.util.StringUtils;
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
/**
* 实体[IBZUSER] 服务对象接口实现
*/
@Service("IBZUAAUserService")
@ConditionalOnExpression("${r'${ibiz.enablePermissionValid:false}'}||'${r'${ibiz.auth.service:SimpleUserService}'}'.equals('IBZUAAUserService')")
public class IBZUAAUserService implements AuthenticationUserService{
@Autowired
......
......@@ -16,11 +16,13 @@ import ${pub.getPKGCodeName()}.util.mapper.IBZUSERMapper;
import ${pub.getPKGCodeName()}.util.domain.IBZUSER;
import org.springframework.util.DigestUtils;
import org.springframework.util.StringUtils;
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
/**
* 实体[IBZUSER] 服务对象接口实现
*/
@Service("IBZUSERService")
@ConditionalOnExpression("(!${r'${ibiz.enablePermissionValid:false}'})&&'${r'${ibiz.auth.service:SimpleUserService}'}'.equals('IBZUSERService')")
public class IBZUSERServiceImpl extends ServiceImpl<IBZUSERMapper, IBZUSER> implements IBZUSERService,AuthenticationUserService{
@Value(${r'"${ibiz.auth.pwencrymode:0}"'})
......
......@@ -19,12 +19,14 @@ import org.springframework.util.StringUtils;
import com.alibaba.fastjson.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
/**
* 实体[IBZUSER] 服务对象接口实现
*/
@Primary
@Service("SimpleUserService")
@ConditionalOnExpression("(!${r'${ibiz.enablePermissionValid:false}'})&&'${r'${ibiz.auth.service:SimpleUserService}'}'.equals('SimpleUserService')")
public class SimpleUserService implements AuthenticationUserService{
@Override
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册