Commit b14012a7 by s_guodong

同步实施场地代码

parent 7ef7a334
...@@ -8,28 +8,30 @@ public class LoginConstants { ...@@ -8,28 +8,30 @@ public class LoginConstants {
//核心编号 //核心编号
public static final String cid = "cid"; public static final String cid = "cid";
//企业操作员编号 //企业操作员编号
public static final String oid= "oid"; public static final String oid = "oid";
//网银编号 //网银编号
public static final String ncid= "ncid"; public static final String ncid = "ncid";
public static final String token="__token"; public static final String token = "__token";
//用户ID //用户ID
public static final String usrinr= "usrinr"; public static final String usrinr = "usrinr";
public static final String userid= "userid"; public static final String userid = "userid";
public static final String cifno= "cifno"; public static final String cifno = "cifno";
public static final String ptyinr= "ptyinr"; public static final String ptyinr = "ptyinr";
public static final String errorText= "errorText"; public static final String errorText = "errorText";
public static final String CN= "CN"; public static final String CN = "CN";
public static final String needSign= "needSign"; public static final String needSign = "needSign";
public static final String __terminalType= "__terminalType"; public static final String __terminalType = "__terminalType";
public static final String algorithm= "algorithm"; public static final String algorithm = "algorithm";
public static final String CERT= "CERT"; public static final String CERT = "CERT";
public static final String url = "url";
} }
...@@ -31,6 +31,9 @@ public class LoginData { ...@@ -31,6 +31,9 @@ public class LoginData {
} else if (LoginConstants.userid.equals(param)) { } else if (LoginConstants.userid.equals(param)) {
BDAuthInfo authInfo = (BDAuthInfo) MdaEnv.getAuthInfo(); BDAuthInfo authInfo = (BDAuthInfo) MdaEnv.getAuthInfo();
return authInfo.getUserid(); return authInfo.getUserid();
} else if (LoginConstants.url.equals(param)) {
BDAuthInfo authInfo = (BDAuthInfo) MdaEnv.getAuthInfo();
return authInfo.getUrl();
} }
return null; return null;
} }
......
...@@ -42,15 +42,15 @@ public class AuthInterceptor implements HandlerInterceptor { ...@@ -42,15 +42,15 @@ public class AuthInterceptor implements HandlerInterceptor {
private ICache<String, IAuthInfo> authInfoICache; private ICache<String, IAuthInfo> authInfoICache;
private IAuthInfo getOrCreateAuthInfo(String tokenKey,Map<String,Object> headMap) { private IAuthInfo getOrCreateAuthInfo(String tokenKey, Map<String, Object> headMap) {
IAuthInfo authInfo = authInfoICache.get(tokenKey); IAuthInfo authInfo = authInfoICache.get(tokenKey);
if (authInfo == null) { if (authInfo == null) {
synchronized (authInfoICache) { synchronized (authInfoICache) {
authInfo = authInfoICache.get(tokenKey); authInfo = authInfoICache.get(tokenKey);
if (authInfo == null) { if (authInfo == null) {
String cid=headMap.get(LoginConstants.cid).toString(); String cid = headMap.get(LoginConstants.cid).toString();
String ncid=headMap.get(LoginConstants.ncid).toString(); String ncid = headMap.get(LoginConstants.ncid).toString();
BDAuthInfo tdAuthInfo = new BDAuthInfo(cid,ncid,"",null,null,null,null,null); BDAuthInfo tdAuthInfo = new BDAuthInfo(cid, ncid, "", null, null, null, null, null, null);
authInfo = tdAuthInfo; authInfo = tdAuthInfo;
authInfoICache.store(tokenKey, authInfo); authInfoICache.store(tokenKey, authInfo);
//构造authInfo,本该在登录里面做 //构造authInfo,本该在登录里面做
......
...@@ -70,6 +70,14 @@ public class AuthorizationRequestFilter implements ContainerRequestFilter { ...@@ -70,6 +70,14 @@ public class AuthorizationRequestFilter implements ContainerRequestFilter {
headMap.put(LoginConstants.algorithm, algorithm); headMap.put(LoginConstants.algorithm, algorithm);
headMap.put(LoginConstants.CERT, CERT); headMap.put(LoginConstants.CERT, CERT);
// 解决sysmod下对登录用户校验的处理
String urlPath = request.getUriInfo().getRequestUri().getPath();
MdaEnv.setAttribute("url", urlPath);
if (urlPath.contains("querySignList") || urlPath.contains("saveSgin")) {
headMap.put(LoginConstants.url, urlPath);
}
//目前采用自动登录模式认证 //目前采用自动登录模式认证
getOrCreateAuthInfo(headMap); getOrCreateAuthInfo(headMap);
//设置一些系统参数 //设置一些系统参数
...@@ -88,7 +96,8 @@ public class AuthorizationRequestFilter implements ContainerRequestFilter { ...@@ -88,7 +96,8 @@ public class AuthorizationRequestFilter implements ContainerRequestFilter {
String __terminalType = headMap.get(LoginConstants.__terminalType) == null ? "" : headMap.get(LoginConstants.__terminalType).toString(); String __terminalType = headMap.get(LoginConstants.__terminalType) == null ? "" : headMap.get(LoginConstants.__terminalType).toString();
String algorithm = headMap.get(LoginConstants.algorithm) == null ? "" : headMap.get(LoginConstants.algorithm).toString(); String algorithm = headMap.get(LoginConstants.algorithm) == null ? "" : headMap.get(LoginConstants.algorithm).toString();
String CERT = headMap.get(LoginConstants.CERT) == null ? "" : headMap.get(LoginConstants.CERT).toString(); String CERT = headMap.get(LoginConstants.CERT) == null ? "" : headMap.get(LoginConstants.CERT).toString();
BDAuthInfo bdAuthInfo = new BDAuthInfo(usrinr, ptyinr, errorText, __terminalType, needSign, CN, algorithm, CERT); String url = headMap.get(LoginConstants.url) == null ? "" : headMap.get(LoginConstants.url).toString();
BDAuthInfo bdAuthInfo = new BDAuthInfo(usrinr, ptyinr, errorText, __terminalType, needSign, CN, algorithm, CERT, url);
MdaEnv.setAuthInfo(bdAuthInfo); MdaEnv.setAuthInfo(bdAuthInfo);
return bdAuthInfo; return bdAuthInfo;
} }
......
...@@ -22,12 +22,15 @@ public class BDAuthInfo implements IAuthInfo { ...@@ -22,12 +22,15 @@ public class BDAuthInfo implements IAuthInfo {
private IStream ddsStream; private IStream ddsStream;
private IStream keepAuthInfo; private IStream keepAuthInfo;
public BDAuthInfo(){} private String url;
public BDAuthInfo(String usrInr, String ptyInr,String errorText,String terminalType,String needSign,String cn,String algorithm,String cert) { public BDAuthInfo() {
}
public BDAuthInfo(String usrInr, String ptyInr, String errorText, String terminalType, String needSign, String cn, String algorithm, String cert, String url) {
this.usrInr = usrInr; this.usrInr = usrInr;
this.ptyInr=ptyInr; this.ptyInr = ptyInr;
this.errorText=errorText; this.errorText = errorText;
this.terminalType = terminalType; this.terminalType = terminalType;
this.needSign = needSign; this.needSign = needSign;
this.cn = cn; this.cn = cn;
...@@ -36,6 +39,7 @@ public class BDAuthInfo implements IAuthInfo { ...@@ -36,6 +39,7 @@ public class BDAuthInfo implements IAuthInfo {
sysStream = new StreamImpl(); sysStream = new StreamImpl();
ddsStream = new StreamImpl(); ddsStream = new StreamImpl();
keepAuthInfo = new StreamImpl(); keepAuthInfo = new StreamImpl();
this.url = url;
} }
@Override @Override
...@@ -93,17 +97,16 @@ public class BDAuthInfo implements IAuthInfo { ...@@ -93,17 +97,16 @@ public class BDAuthInfo implements IAuthInfo {
return keepAuthInfo; return keepAuthInfo;
} }
public void recoveryAuthInfo(){ public void recoveryAuthInfo() {
List<String> keyRows = this.getKeepAuthInfo().getRows(); List<String> keyRows = this.getKeepAuthInfo().getRows();
List<String> sysRows = this.getSysStream().getRows(); List<String> sysRows = this.getSysStream().getRows();
for(int i=0;i< keyRows.size();i+=2){ for (int i = 0; i < keyRows.size(); i += 2) {
String key = keyRows.get(i); String key = keyRows.get(i);
String value = keyRows.get(i+1); String value = keyRows.get(i + 1);
int idx = sysRows.indexOf(key); int idx = sysRows.indexOf(key);
if(idx>=0){ if (idx >= 0) {
sysRows.set(idx+1,value); sysRows.set(idx + 1, value);
} } else {
else{
sysRows.add(key); sysRows.add(key);
sysRows.add(value); sysRows.add(value);
} }
...@@ -137,4 +140,12 @@ public class BDAuthInfo implements IAuthInfo { ...@@ -137,4 +140,12 @@ public class BDAuthInfo implements IAuthInfo {
public void setSrc(String src) { public void setSrc(String src) {
this.src = src; this.src = src;
} }
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment