Commit 3bf5e392 authored by 喻春霖's avatar 喻春霖

fixed

parent e70a2818
...@@ -120,14 +120,22 @@ public class AuthController { ...@@ -120,14 +120,22 @@ public class AuthController {
authLogService.save(authLog); authLogService.save(authLog);
String url1 = generateLoginUrl(returnUrl, OauthType.dianjiaoguan.getCode(), authLog.getId()); String dianjiaoguanLoinUrl = generateLoginUrl(returnUrl, OauthType.dianjiaoguan.getCode(), authLog.getId());
modelAndView.addObject("loginUrl1", url1); modelAndView.addObject("dianjiaoguanLoinUrl", dianjiaoguanLoinUrl);
String url2 = generateLoginUrl(returnUrl, OauthType.edenoperation.getCode(), authLog.getId()); String edenoperationLoginUrl = generateLoginUrl(returnUrl, OauthType.edenoperation.getCode(), authLog.getId());
modelAndView.addObject("loginUrl2", url2); modelAndView.addObject("edenoperationLoginUrl", edenoperationLoginUrl);
String url3 = generateSpLoginUrl(returnUrl, OauthType.qpjy.getCode(), authLog.getId());
modelAndView.addObject("loginUrl3", url3); OauthType[] oauthTypes = OauthType.values();
modelAndView.addObject("logId", authLog.getId()); for (OauthType oauthType : oauthTypes) {
if ("idp".equals(oauthType.getType())){
String idpAuthTypeUrl = generateSpLoginUrl(returnUrl, oauthType.getCode(), authLog.getId());
modelAndView.addObject(oauthType.getCode()+"LoginUrl", idpAuthTypeUrl);
}
}
modelAndView.addObject("logId", authLog.getId());
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
modelAndView.setViewName("error"); modelAndView.setViewName("error");
......
...@@ -2,17 +2,31 @@ package com.chineseall.eden.authcenter.agent.oauth; ...@@ -2,17 +2,31 @@ package com.chineseall.eden.authcenter.agent.oauth;
import lombok.Getter; import lombok.Getter;
import java.util.List;
public enum OauthType { public enum OauthType {
dianjiaoguan("dianjiaoguan","电教馆账号认证"), dianjiaoguan("dianjiaoguan","电教馆账号认证","oauth"),
idp("idp","idp认证"),
jsyd("jsyd","金山教育"), edenoperation("edenoperation","数字教材账号认证","oauth"),
qpjy("qpjy","青浦教育"), jsyd("jsyd","金山教育","idp"),
hpjy("hpjy","黄浦教育"), qpjy("qpjy","青浦教育","idp"),
fxjy("fxjy","奉贤教育"), xhjy("xhjy","徐汇教育","idp"),
pdjy("pdjy","浦东教育"), cnjy("cnjy","长宁教育","idp"),
ypjy("ypjy","杨浦教育"), jajy("jajy","静安教育","idp"),
edenoperation("edenoperation","数字教材账号认证"); ptjy("ptjy","普陀教育","idp"),
hkjy("hkjy","虹口教育","idp"),
mhjy("mhjy","闵行教育","idp"),
bsjy("bsjy","宝山教育","idp"),
jdjy("jdjy","嘉定教育","idp"),
jsjy("jsjy","金山教育","idp"),
sjjy("sjjy","松江教育","idp"),
fxjy("fxjy","奉贤教育","idp"),
cmjy("cmjy","崇明教育","idp"),
hpjy("hpjy","黄浦教育","idp"),
pdjy("pdjy","浦东教育","idp"),
ypjy("ypjy","杨浦教育","idp");
@Getter @Getter
...@@ -20,9 +34,16 @@ public enum OauthType { ...@@ -20,9 +34,16 @@ public enum OauthType {
@Getter @Getter
private final String description; private final String description;
OauthType(String code, String description) {
@Getter
private final String type;
OauthType(String code, String description,String type) {
this.code = code; this.code = code;
this.description = description; this.description = description;
this.type = type;
} }
public static OauthType getValue(String name) { public static OauthType getValue(String name) {
......
...@@ -49,6 +49,113 @@ oauth: ...@@ -49,6 +49,113 @@ oauth:
clientSecret: VjyqUkkM5Znu clientSecret: VjyqUkkM5Znu
loginSuccessUrl: https://ds-test.etextbook.cn/authcenter/auth/idp/loginsuccess loginSuccessUrl: https://ds-test.etextbook.cn/authcenter/auth/idp/loginsuccess
logoutSuccessUrl: https://ds-test.etextbook.cn/authcenter/auth/logoutsuccess logoutSuccessUrl: https://ds-test.etextbook.cn/authcenter/auth/logoutsuccess
cmjy: #idp
#oauthUrl: https://operator-api-test.etextbook.cn/cas
oauthUrl: https://sp.etextbook.cn/authcenter/auth
clientId: dsClentId
clientSecret: VjyqUkkM5Znu
loginSuccessUrl: https://ds-test.etextbook.cn/authcenter/auth/idp/loginsuccess
logoutSuccessUrl: https://ds-test.etextbook.cn/authcenter/auth/logoutsuccess
fxjy: #idp
#oauthUrl: https://operator-api-test.etextbook.cn/cas
oauthUrl: https://sp.etextbook.cn/authcenter/auth
clientId: dsClentId
clientSecret: VjyqUkkM5Znu
loginSuccessUrl: https://ds-test.etextbook.cn/authcenter/auth/idp/loginsuccess
logoutSuccessUrl: https://ds-test.etextbook.cn/authcenter/auth/logoutsuccess
sjjy: #idp
#oauthUrl: https://operator-api-test.etextbook.cn/cas
oauthUrl: https://sp.etextbook.cn/authcenter/auth
clientId: dsClentId
clientSecret: VjyqUkkM5Znu
loginSuccessUrl: https://ds-test.etextbook.cn/authcenter/auth/idp/loginsuccess
logoutSuccessUrl: https://ds-test.etextbook.cn/authcenter/auth/logoutsuccess
jsjy: #idp
#oauthUrl: https://operator-api-test.etextbook.cn/cas
oauthUrl: https://sp.etextbook.cn/authcenter/auth
clientId: dsClentId
clientSecret: VjyqUkkM5Znu
loginSuccessUrl: https://ds-test.etextbook.cn/authcenter/auth/idp/loginsuccess
logoutSuccessUrl: https://ds-test.etextbook.cn/authcenter/auth/logoutsuccess
jdjy: #idp
#oauthUrl: https://operator-api-test.etextbook.cn/cas
oauthUrl: https://sp.etextbook.cn/authcenter/auth
clientId: dsClentId
clientSecret: VjyqUkkM5Znu
loginSuccessUrl: https://ds-test.etextbook.cn/authcenter/auth/idp/loginsuccess
logoutSuccessUrl: https://ds-test.etextbook.cn/authcenter/auth/logoutsuccess
bsjy: #idp
#oauthUrl: https://operator-api-test.etextbook.cn/cas
oauthUrl: https://sp.etextbook.cn/authcenter/auth
clientId: dsClentId
clientSecret: VjyqUkkM5Znu
loginSuccessUrl: https://ds-test.etextbook.cn/authcenter/auth/idp/loginsuccess
logoutSuccessUrl: https://ds-test.etextbook.cn/authcenter/auth/logoutsuccess
mhjy: #idp
#oauthUrl: https://operator-api-test.etextbook.cn/cas
oauthUrl: https://sp.etextbook.cn/authcenter/auth
clientId: dsClentId
clientSecret: VjyqUkkM5Znu
loginSuccessUrl: https://ds-test.etextbook.cn/authcenter/auth/idp/loginsuccess
logoutSuccessUrl: https://ds-test.etextbook.cn/authcenter/auth/logoutsuccess
pdjy: #idp
#oauthUrl: https://operator-api-test.etextbook.cn/cas
oauthUrl: https://sp.etextbook.cn/authcenter/auth
clientId: dsClentId
clientSecret: VjyqUkkM5Znu
loginSuccessUrl: https://ds-test.etextbook.cn/authcenter/auth/idp/loginsuccess
logoutSuccessUrl: https://ds-test.etextbook.cn/authcenter/auth/logoutsuccess
ypjy: #idp
#oauthUrl: https://operator-api-test.etextbook.cn/cas
oauthUrl: https://sp.etextbook.cn/authcenter/auth
clientId: dsClentId
clientSecret: VjyqUkkM5Znu
loginSuccessUrl: https://ds-test.etextbook.cn/authcenter/auth/idp/loginsuccess
logoutSuccessUrl: https://ds-test.etextbook.cn/authcenter/auth/logoutsuccess
hkjy: #idp
#oauthUrl: https://operator-api-test.etextbook.cn/cas
oauthUrl: https://sp.etextbook.cn/authcenter/auth
clientId: dsClentId
clientSecret: VjyqUkkM5Znu
loginSuccessUrl: https://ds-test.etextbook.cn/authcenter/auth/idp/loginsuccess
logoutSuccessUrl: https://ds-test.etextbook.cn/authcenter/auth/logoutsuccess
ptjy: #idp
#oauthUrl: https://operator-api-test.etextbook.cn/cas
oauthUrl: https://sp.etextbook.cn/authcenter/auth
clientId: dsClentId
clientSecret: VjyqUkkM5Znu
loginSuccessUrl: https://ds-test.etextbook.cn/authcenter/auth/idp/loginsuccess
logoutSuccessUrl: https://ds-test.etextbook.cn/authcenter/auth/logoutsuccess
jajy: #idp
#oauthUrl: https://operator-api-test.etextbook.cn/cas
oauthUrl: https://sp.etextbook.cn/authcenter/auth
clientId: dsClentId
clientSecret: VjyqUkkM5Znu
loginSuccessUrl: https://ds-test.etextbook.cn/authcenter/auth/idp/loginsuccess
logoutSuccessUrl: https://ds-test.etextbook.cn/authcenter/auth/logoutsuccess
cnjy: #idp
#oauthUrl: https://operator-api-test.etextbook.cn/cas
oauthUrl: https://sp.etextbook.cn/authcenter/auth
clientId: dsClentId
clientSecret: VjyqUkkM5Znu
loginSuccessUrl: https://ds-test.etextbook.cn/authcenter/auth/idp/loginsuccess
logoutSuccessUrl: https://ds-test.etextbook.cn/authcenter/auth/logoutsuccess
xhjy: #idp
#oauthUrl: https://operator-api-test.etextbook.cn/cas
oauthUrl: https://sp.etextbook.cn/authcenter/auth
clientId: dsClentId
clientSecret: VjyqUkkM5Znu
loginSuccessUrl: https://ds-test.etextbook.cn/authcenter/auth/idp/loginsuccess
logoutSuccessUrl: https://ds-test.etextbook.cn/authcenter/auth/logoutsuccess
hpjy: #idp
#oauthUrl: https://operator-api-test.etextbook.cn/cas
oauthUrl: https://sp.etextbook.cn/authcenter/auth
clientId: dsClentId
clientSecret: VjyqUkkM5Znu
loginSuccessUrl: https://ds-test.etextbook.cn/authcenter/auth/idp/loginsuccess
logoutSuccessUrl: https://ds-test.etextbook.cn/authcenter/auth/logoutsuccess
oauthclient: oauthclient:
clients: clients:
- clientName: 数字教材 - clientName: 数字教材
......
...@@ -49,6 +49,112 @@ oauth: ...@@ -49,6 +49,112 @@ oauth:
clientSecret: VjyqUkkM5Znu clientSecret: VjyqUkkM5Znu
loginSuccessUrl: https://ds-test.etextbook.cn/authcenter/auth/idp/loginsuccess loginSuccessUrl: https://ds-test.etextbook.cn/authcenter/auth/idp/loginsuccess
logoutSuccessUrl: https://ds-test.etextbook.cn/authcenter/auth/logoutsuccess logoutSuccessUrl: https://ds-test.etextbook.cn/authcenter/auth/logoutsuccess
cmjy: #idp
#oauthUrl: https://operator-api-test.etextbook.cn/cas
oauthUrl: https://sp.etextbook.cn/authcenter/auth
clientId: dsClentId
clientSecret: VjyqUkkM5Znu
loginSuccessUrl: https://ds-test.etextbook.cn/authcenter/auth/idp/loginsuccess
logoutSuccessUrl: https://ds-test.etextbook.cn/authcenter/auth/logoutsuccess
fxjy: #idp
#oauthUrl: https://operator-api-test.etextbook.cn/cas
oauthUrl: https://sp.etextbook.cn/authcenter/auth
clientId: dsClentId
clientSecret: VjyqUkkM5Znu
loginSuccessUrl: https://ds-test.etextbook.cn/authcenter/auth/idp/loginsuccess
logoutSuccessUrl: https://ds-test.etextbook.cn/authcenter/auth/logoutsuccess
sjjy: #idp
#oauthUrl: https://operator-api-test.etextbook.cn/cas
oauthUrl: https://sp.etextbook.cn/authcenter/auth
clientId: dsClentId
clientSecret: VjyqUkkM5Znu
loginSuccessUrl: https://ds-test.etextbook.cn/authcenter/auth/idp/loginsuccess
logoutSuccessUrl: https://ds-test.etextbook.cn/authcenter/auth/logoutsuccess
jsjy: #idp
#oauthUrl: https://operator-api-test.etextbook.cn/cas
oauthUrl: https://sp.etextbook.cn/authcenter/auth
clientId: dsClentId
clientSecret: VjyqUkkM5Znu
loginSuccessUrl: https://ds-test.etextbook.cn/authcenter/auth/idp/loginsuccess
logoutSuccessUrl: https://ds-test.etextbook.cn/authcenter/auth/logoutsuccess
jdjy: #idp
#oauthUrl: https://operator-api-test.etextbook.cn/cas
oauthUrl: https://sp.etextbook.cn/authcenter/auth
clientId: dsClentId
clientSecret: VjyqUkkM5Znu
loginSuccessUrl: https://ds-test.etextbook.cn/authcenter/auth/idp/loginsuccess
logoutSuccessUrl: https://ds-test.etextbook.cn/authcenter/auth/logoutsuccess
bsjy: #idp
#oauthUrl: https://operator-api-test.etextbook.cn/cas
oauthUrl: https://sp.etextbook.cn/authcenter/auth
clientId: dsClentId
clientSecret: VjyqUkkM5Znu
loginSuccessUrl: https://ds-test.etextbook.cn/authcenter/auth/idp/loginsuccess
logoutSuccessUrl: https://ds-test.etextbook.cn/authcenter/auth/logoutsuccess
mhjy: #idp
#oauthUrl: https://operator-api-test.etextbook.cn/cas
oauthUrl: https://sp.etextbook.cn/authcenter/auth
clientId: dsClentId
clientSecret: VjyqUkkM5Znu
loginSuccessUrl: https://ds-test.etextbook.cn/authcenter/auth/idp/loginsuccess
logoutSuccessUrl: https://ds-test.etextbook.cn/authcenter/auth/logoutsuccess
pdjy: #idp
#oauthUrl: https://operator-api-test.etextbook.cn/cas
oauthUrl: https://sp.etextbook.cn/authcenter/auth
clientId: dsClentId
clientSecret: VjyqUkkM5Znu
loginSuccessUrl: https://ds-test.etextbook.cn/authcenter/auth/idp/loginsuccess
logoutSuccessUrl: https://ds-test.etextbook.cn/authcenter/auth/logoutsuccess
ypjy: #idp
#oauthUrl: https://operator-api-test.etextbook.cn/cas
oauthUrl: https://sp.etextbook.cn/authcenter/auth
clientId: dsClentId
clientSecret: VjyqUkkM5Znu
loginSuccessUrl: https://ds-test.etextbook.cn/authcenter/auth/idp/loginsuccess
logoutSuccessUrl: https://ds-test.etextbook.cn/authcenter/auth/logoutsuccess
hkjy: #idp
#oauthUrl: https://operator-api-test.etextbook.cn/cas
oauthUrl: https://sp.etextbook.cn/authcenter/auth
clientId: dsClentId
clientSecret: VjyqUkkM5Znu
loginSuccessUrl: https://ds-test.etextbook.cn/authcenter/auth/idp/loginsuccess
logoutSuccessUrl: https://ds-test.etextbook.cn/authcenter/auth/logoutsuccess
ptjy: #idp
#oauthUrl: https://operator-api-test.etextbook.cn/cas
oauthUrl: https://sp.etextbook.cn/authcenter/auth
clientId: dsClentId
clientSecret: VjyqUkkM5Znu
loginSuccessUrl: https://ds-test.etextbook.cn/authcenter/auth/idp/loginsuccess
logoutSuccessUrl: https://ds-test.etextbook.cn/authcenter/auth/logoutsuccess
jajy: #idp
#oauthUrl: https://operator-api-test.etextbook.cn/cas
oauthUrl: https://sp.etextbook.cn/authcenter/auth
clientId: dsClentId
clientSecret: VjyqUkkM5Znu
loginSuccessUrl: https://ds-test.etextbook.cn/authcenter/auth/idp/loginsuccess
logoutSuccessUrl: https://ds-test.etextbook.cn/authcenter/auth/logoutsuccess
cnjy: #idp
#oauthUrl: https://operator-api-test.etextbook.cn/cas
oauthUrl: https://sp.etextbook.cn/authcenter/auth
clientId: dsClentId
clientSecret: VjyqUkkM5Znu
loginSuccessUrl: https://ds-test.etextbook.cn/authcenter/auth/idp/loginsuccess
logoutSuccessUrl: https://ds-test.etextbook.cn/authcenter/auth/logoutsuccess
xhjy: #idp
#oauthUrl: https://operator-api-test.etextbook.cn/cas
oauthUrl: https://sp.etextbook.cn/authcenter/auth
clientId: dsClentId
clientSecret: VjyqUkkM5Znu
loginSuccessUrl: https://ds-test.etextbook.cn/authcenter/auth/idp/loginsuccess
logoutSuccessUrl: https://ds-test.etextbook.cn/authcenter/auth/logoutsuccess
hpjy: #idp
#oauthUrl: https://operator-api-test.etextbook.cn/cas
oauthUrl: https://sp.etextbook.cn/authcenter/auth
clientId: dsClentId
clientSecret: VjyqUkkM5Znu
loginSuccessUrl: https://ds-test.etextbook.cn/authcenter/auth/idp/loginsuccess
logoutSuccessUrl: https://ds-test.etextbook.cn/authcenter/auth/logoutsuccess
oauthclient: oauthclient:
clients: clients:
- clientName: 数字教材 - clientName: 数字教材
......
...@@ -9,52 +9,38 @@ ...@@ -9,52 +9,38 @@
<script type="text/javascript" th:src="@{/static/js/browser.js}"></script> <script type="text/javascript" th:src="@{/static/js/browser.js}"></script>
<script th:inline="javascript"> <script th:inline="javascript">
/*<![CDATA[*/ /*<![CDATA[*/
var loginUrl1 = [[${loginUrl1}]]; var dianjiaoguanLoinUrl = [[${dianjiaoguanLoinUrl}]];
var loginUrl2 = [[${loginUrl2}]]; var edenoperationLoginUrl = [[${edenoperationLoginUrl}]];
var loginUrl3 = [[${loginUrl3}]];
var loginUrl4 = [[${loginUrl4}]];
var loginUrl5 = [[${loginUrl5}]];
var loginUrl6 = [[${loginUrl6}]];
var loginUrl7 = [[${loginUrl7}]];
var loginUrl8 = [[${loginUrl8}]];
var loginUrl9 = [[${loginUrl9}]];
var loginUrl10 = [[${loginUrl10}]];
var loginUrl11 = [[${loginUrl11}]];
var loginUrl12 = [[${loginUrl12}]];
var loginUrl13 = [[${loginUrl13}]];
var loginUrl14 = [[${loginUrl14}]];
var loginUrl15 = [[${loginUrl15}]];
var loginUrl16 = [[${loginUrl16}]];
var logId = [[${logId}]]; var logId = [[${logId}]];
var loginType = [[${loginType}]]; var loginType = [[${loginType}]];
var ctxPath = /*[[@{/}]]*/ ''; var ctxPath = /*[[@{/}]]*/ '';
var idpList = { var idpList = {
qpjy: loginurl3, qpjy: [[${qpjyLoginUrl}]],
hpjy: loginurl4, hpjy: [[${hpjyLoginUrl}]],
xhjy: loginurl5, xhjy: [[${xhjyLoginUrl}]],
cnjy: loginurl6, cnjy: [[${cnjyLoginUrl}]],
ptjy: loginurl7, ptjy: [[${ptjyLoginUrl}]],
hkjy: loginurl8, hkjy: [[${hkjyLoginUrl}]],
ypjy: loginurl9, ypjy: [[${ypjyLoginUrl}]],
pdjy: loginurl10, pdjy: [[${pdjyLoginUrl}]],
mhjy: loginurl11, mhjy: [[${mhjyLoginUrl}]],
bsjy: loginurl12, bsjy: [[${bsjyLoginUrl}]],
jsjy: loginurl13, jsjy: [[${jsjyLoginUrl}]],
sjjy: loginurl14, sjjy: [[${sjjyLoginUrl}]],
fxjy: loginurl15, fxjy: [[${fxjyLoginUrl}]],
cmjy: loginurl16, cmjy: [[${cmjyLoginUrl}]],
jajy: '', jajy: [[${jajyLoginUrl}]],
jdjy: '', jdjy: [[${jdjyLoginUrl}]],
} }
function toLogin(idp) { function toLogin(idp) {
var info = new Browser(); var info = new Browser();
var baseUrl = ctxPath + "auth/tologin?logId="+logId+"&oauthType="; var baseUrl = ctxPath + "auth/tologin?logId="+logId+"&oauthType=";
if (idp=="dianjiaoguan") { if (idp=="dianjiaoguan") {
window.location.href = baseUrl+ "dianjiaoguan&loginUrl=" + encodeURIComponent(loginUrl1)+"&browser="+info.browser+"&device="+info.device+"&os="+info.os+"&version="+info.version; window.location.href = baseUrl+ "dianjiaoguan&loginUrl=" + encodeURIComponent(dianjiaoguanLoinUrl)+"&browser="+info.browser+"&device="+info.device+"&os="+info.os+"&version="+info.version;
} else if (idp=="edenoperation") { } else if (idp=="edenoperation") {
window.location.href = baseUrl+ "edenoperation&loginUrl=" + encodeURIComponent(loginUrl2)+"&browser="+info.browser+"&device="+info.device+"&os="+info.os+"&version="+info.version; window.location.href = baseUrl+ "edenoperation&loginUrl=" + encodeURIComponent(edenoperationLoginUrl)+"&browser="+info.browser+"&device="+info.device+"&os="+info.os+"&version="+info.version;
} else if (idpList[idp]) { } else {
window.location.href = baseUrl+idp+"&loginUrl=" + encodeURIComponent(idpList[idp]+"&auth_source="+idp)+"&browser="+info.browser+"&device="+info.device+"&os="+info.os+"&version="+info.version; window.location.href = baseUrl+idp+"&loginUrl=" + encodeURIComponent(idpList[idp]+"&auth_source="+idp)+"&browser="+info.browser+"&device="+info.device+"&os="+info.os+"&version="+info.version;
} }
} }
...@@ -151,14 +137,5 @@ ...@@ -151,14 +137,5 @@
<div class="footer"> <div class="footer">
<p class="footer-text">版权所有&copy;上海教育认证中心</p> <p class="footer-text">版权所有&copy;上海教育认证中心</p>
</div> </div>
<script th:inline="javascript">
/*<![CDATA[*/
var loginUrl1 = [[${loginUrl1}]];
var loginUrl2 = [[${loginUrl2}]];
var loginUrl3 = [[${loginUrl3}]];
var logId = [[${logId}]];
var ctxPath = /*[[@{/}]]*/ '';
/*]]>*/
</script>
</body> </body>
</html> </html>
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