提交 7315252c 编写于 作者: M MaxKey

socialSignOn

上级 ad2dbb1c
......@@ -83,20 +83,23 @@ public class AbstractSocialSignOnEndpoint {
ApplicationConfig applicationConfig;
protected AuthRequest buildAuthRequest(String provider){
SocialSignOnProvider socialSignOnProvider = socialSignOnProviderService.get(provider);
_logger.debug("socialSignOn Provider : "+socialSignOnProvider);
if(socialSignOnProvider!=null){
authRequest=socialSignOnProviderService.getAuthRequest(provider,applicationConfig);
WebContext.setAttribute(SOCIALSIGNON_OAUTH_SERVICE_SESSION, authRequest);
WebContext.setAttribute(SOCIALSIGNON_PROVIDER_SESSION, socialSignOnProvider);
return authRequest;
}
try {
SocialSignOnProvider socialSignOnProvider = socialSignOnProviderService.get(provider);
_logger.debug("socialSignOn Provider : "+socialSignOnProvider);
if(socialSignOnProvider!=null){
authRequest=socialSignOnProviderService.getAuthRequest(provider,applicationConfig);
WebContext.setAttribute(SOCIALSIGNON_OAUTH_SERVICE_SESSION, authRequest);
WebContext.setAttribute(SOCIALSIGNON_PROVIDER_SESSION, socialSignOnProvider);
return authRequest;
}
}catch(Exception e) {
_logger.debug("buildAuthRequest Exception ",e);
}
return null;
}
protected String authCallback() {
protected String authCallback() throws Exception {
authRequest=(AuthRequest)WebContext.getAttribute(SOCIALSIGNON_OAUTH_SERVICE_SESSION);
socialSignOnProvider=(SocialSignOnProvider)WebContext.getAttribute(SOCIALSIGNON_PROVIDER_SESSION);
WebContext.removeAttribute(SOCIALSIGNON_OAUTH_SERVICE_SESSION);
......
......@@ -24,7 +24,6 @@ import javax.servlet.http.HttpServletRequest;
import org.maxkey.authn.support.socialsignon.service.SocialSignOnProvider;
import org.maxkey.authn.support.socialsignon.service.SocialsAssociate;
import org.maxkey.configuration.ApplicationConfig;
import org.maxkey.constants.ConstantsLoginType;
import org.maxkey.web.WebContext;
import org.slf4j.Logger;
......@@ -48,9 +47,9 @@ public class SocialSignOnEndpoint extends AbstractSocialSignOnEndpoint{
final static Logger _logger = LoggerFactory.getLogger(SocialSignOnEndpoint.class);
public ModelAndView socialSignOnAuthorize(HttpServletRequest request,String provider){
_logger.debug("SocialSignOn provider : "+provider);
_logger.trace("SocialSignOn provider : "+provider);
String authorizationUrl=buildAuthRequest(provider).authorize(request.getSession().getId());
_logger.debug("authorize SocialSignOn : "+authorizationUrl);
_logger.trace("authorize SocialSignOn : "+authorizationUrl);
return WebContext.redirect(authorizationUrl);
}
......@@ -111,12 +110,10 @@ public class SocialSignOnEndpoint extends AbstractSocialSignOnEndpoint{
@RequestMapping(value={"/callback/{provider}"}, method = RequestMethod.GET)
public ModelAndView callback(@PathVariable String provider
) {
SocialsAssociate socialsAssociate = null;
//auth call back may exception
public ModelAndView callback(@PathVariable String provider) {
//auth call back may exception
try {
SocialsAssociate socialsAssociate = null;
this.provider=provider;
this.authCallback();
_logger.debug(this.accountId);
......@@ -124,29 +121,30 @@ public class SocialSignOnEndpoint extends AbstractSocialSignOnEndpoint{
socialsAssociate.setProvider(provider);
socialsAssociate.setSocialuid(this.accountId);
//for login
String socialSignOnType= "";
if(WebContext.getAttribute(SOCIALSIGNON_TYPE_SESSION)!=null){
socialSignOnType=WebContext.getAttribute(SOCIALSIGNON_TYPE_SESSION).toString();
}
if(socialSignOnType.equals(SOCIALSIGNON_TYPE.SOCIALSIGNON_TYPE_LOGON)||socialSignOnType.equals("")){
socialSignOn(socialsAssociate);
return WebContext.redirect("/index");
}else{
socialBind(socialsAssociate);
}
if(WebContext.getAttribute(SOCIALSIGNON_SESSION_REDIRECT_URI)!=null){
return WebContext.redirect(WebContext.getAttribute(SOCIALSIGNON_SESSION_REDIRECT_URI).toString());
}else{
return WebContext.forward("/socialsignon/list");
}
}catch(Exception e) {
_logger.error("callback Exception ",e);
}
//for login
String socialSignOnType= "";
if(WebContext.getAttribute(SOCIALSIGNON_TYPE_SESSION)!=null){
socialSignOnType=WebContext.getAttribute(SOCIALSIGNON_TYPE_SESSION).toString();
}
if(socialSignOnType.equals(SOCIALSIGNON_TYPE.SOCIALSIGNON_TYPE_LOGON)||socialSignOnType.equals("")){
socialSignOn(socialsAssociate);
return WebContext.redirect("/index");
}else{
socialBind(socialsAssociate);
}
if(WebContext.getAttribute(SOCIALSIGNON_SESSION_REDIRECT_URI)!=null){
return WebContext.redirect(WebContext.getAttribute(SOCIALSIGNON_SESSION_REDIRECT_URI).toString());
}else{
return WebContext.forward("/socialsignon/list");
}
return WebContext.redirect("/login");
}
public boolean socialBind(SocialsAssociate socialsAssociate){
......
......@@ -21,7 +21,6 @@ import java.util.HashMap;
import java.util.List;
import org.maxkey.configuration.ApplicationConfig;
import org.maxkey.web.WebContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -44,7 +43,7 @@ public class SocialSignOnProviderService{
return socialSignOnProviderMaps.get(provider);
}
public AuthRequest getAuthRequest(String provider,ApplicationConfig applicationConfig) {
public AuthRequest getAuthRequest(String provider,ApplicationConfig applicationConfig) throws Exception {
AuthRequest authRequest = null;
AuthConfig authConfig = AuthConfig.builder()
.clientId(this.get(provider).getClientId())
......@@ -107,7 +106,7 @@ public class SocialSignOnProviderService{
return authRequest;
}
public String getAccountId(String provider,AuthResponse<?> authResponse) {
public String getAccountId(String provider,AuthResponse<?> authResponse) throws Exception {
if(provider.equalsIgnoreCase("WeChatOpen")) {
return ((AuthUser)authResponse.getData()).getUuid();
}else if(provider.equalsIgnoreCase("sinaweibo")) {
......
global.title=MaxKey\u8eab\u4efd\u5b89\u5168\u7ba1\u7406\u7cfb\u7edf
global.application=Max<span style="color: #FFD700;">Key</span>\u8eab\u4efd\u5b89\u5168\u7ba1\u7406\u7cfb\u7edf
global.title=Genvict\u8eab\u4efd\u5b89\u5168\u7ba1\u7406\u7cfb\u7edf
global.application=Genvict\u8eab\u4efd\u5b89\u5168\u7ba1\u7406\u7cfb\u7edf
global.change.language=\u8bed\u8a00\u9009\u62e9
global.change.language.en=English
global.change.language.zh=\u4e2d\u6587
......@@ -462,6 +462,7 @@ synchronizers.trustStore=\u8BC1\u4E66\u8DEF\u5F84
synchronizers.trustStorePassword=\u8BC1\u4E66\u5BC6\u94A5
synchronizers.resumeTime=\u6062\u590D\u65F6\u95F4
synchronizers.suspendTime=\u6302\u8D77\u65F6\u95F4
synchronizers.syncStartTime=\u533A\u95F4
#button
button.text.action=\u8bbf\u95ee
button.text.visit=\u8bbf\u95ee
......@@ -525,7 +526,7 @@ log.synchronizer.objectType=\u5BF9\u8C61\u540D\u79F0
log.synchronizer.objectName=\u5BF9\u8C61\u540D\u79F0
log.synchronizer.syncTime=\u540C\u6B65\u65F6\u95F4
log.synchronizer.result=\u7ED3\u679C
#connector
log.connector.id=\u7F16\u53F7
log.connector.conName=\u8FDE\u63A5\u5668
log.connector.conType=\u7C7B\u578B
......@@ -537,7 +538,6 @@ log.connector.description=\u63CF\u8FF0
log.connector.syncTime=\u65F6\u95F4
log.connector.result=\u7ED3\u679C
#message
message.action.insert.success=\u65b0\u589e\u64cd\u4f5c\u6210\u529f
message.action.insert.error=\u65b0\u589e\u64cd\u4f5c\u5931\u8d25
message.action.update.success=\u66f4\u65b0\u64cd\u4f5c\u6210\u529f
......@@ -546,16 +546,17 @@ message.action.delete.success=\u5220\u9664\u64cd\u4f5c\u6210\u529f
message.action.delete.error=\u5220\u9664\u64cd\u4f5c\u5931\u8d25
message.action.import.success=\u6279\u91cf\u5bfc\u5165\u6210\u529f
message.action.import.error=\u6279\u91cf\u5bfc\u5165\u5931\u8d25
#import
import.title=\u6279\u91cf\u5bfc\u5165\u6570\u636e
import.file.select=\u9009\u62e9\u5bfc\u5165\u6587\u4ef6
import.template.download=\u4e0b\u8f7d\u6a21\u677f
import.update.exist=\u66f4\u65b0\u5b58\u5728\u6570\u636e
import.tip=\u63d0\u793a\uff1a\u4ec5\u5141\u8bb8\u5bfc\u5165\u201cxls\u201d\u6216\u8005\u201cxlsx\u201d\u683c\u5f0f\u7684\u6587\u4ef6
#Notices
notices.title=\u6807\u9898
notices.content=\u5185\u5BB9
#navs
navs.system=\u7cfb\u7edf
navs.home=\u9996\u9875
navs.orgs=\u673a\u6784\u7ba1\u7406
......
global.title=MaxKey Secure Management
global.application=Max<span style="color: #FFD700;">Key</span> Secure Management
global.title=Genvict Secure Management
global.application=Secure Management
global.change.language=Language
global.change.language.en=English
global.change.language.zh=\u4e2d\u6587
......@@ -473,6 +473,7 @@ synchronizers.trustStore=trustStore
synchronizers.trustStorePassword=trustStorePassword
synchronizers.resumeTime=resumeTime
synchronizers.suspendTime=suspendTime
synchronizers.syncStartTime=During
button.text.action=Action
......@@ -538,7 +539,6 @@ log.synchronizer.objectName=ObjectName
log.synchronizer.syncTime=SyncTime
log.synchronizer.result=Result
log.connector.id=Id
log.connector.conName=Connector
log.connector.conType=Type
......
global.title=MaxKey\u8eab\u4efd\u5b89\u5168\u7ba1\u7406\u7cfb\u7edf
global.application=Max<span style="color: #FFD700;">Key</span>\u8eab\u4efd\u5b89\u5168\u7ba1\u7406\u7cfb\u7edf
global.title=Genvict\u8eab\u4efd\u5b89\u5168\u7ba1\u7406\u7cfb\u7edf
global.application=\u8eab\u4efd\u5b89\u5168\u7ba1\u7406\u7cfb\u7edf
global.change.language=\u8bed\u8a00\u9009\u62e9
global.change.language.en=English
global.change.language.zh=\u4e2d\u6587
......@@ -468,7 +468,8 @@ synchronizers.trustStore=\u8BC1\u4E66\u8DEF\u5F84
synchronizers.trustStorePassword=\u8BC1\u4E66\u5BC6\u94A5
synchronizers.resumeTime=\u6062\u590D\u65F6\u95F4
synchronizers.suspendTime=\u6302\u8D77\u65F6\u95F4
#button
synchronizers.syncStartTime=\u533A\u95F4
button.text.action=\u8bbf\u95ee
button.text.visit=\u8bbf\u95ee
button.text.save=\u4fdd\u5b58
......@@ -489,7 +490,7 @@ button.text.hidden=\u9690\u85cf
button.text.import=\u5bfc\u5165
button.text.adjunct=\u517c\u4efb\u673a\u6784
button.text.sync=\u540C\u6B65
#history login
#loginhistory
log.loginhistory.id=\u7f16\u53f7
log.loginhistory.sessionId=\u4f1a\u8bdd
log.loginhistory.username=\u767b\u5f55\u540d
......@@ -506,7 +507,7 @@ log.loginhistory.application=\u5e94\u7528
log.loginhistory.loginUrl=\u767b\u5f55\u5730\u5740
log.loginhistory.code=\u4ee3\u7801
log.loginhistory.rpUserInfo=\u7b2c\u4e09\u65b9
#history login apps
#loginappshistory
log.loginappshistory.id=\u7f16\u53f7
log.loginappshistory.sessionId=\u4f1a\u8bdd
log.loginappshistory.uid=\u7528\u6237\u7f16\u53f7
......@@ -515,14 +516,14 @@ log.loginappshistory.displayName=\u7528\u6237\u540d
log.loginappshistory.appId=\u5e94\u7528\u7f16\u53f7
log.loginappshistory.appName=\u5e94\u7528\u540d\u79f0
log.loginappshistory.loginTime=\u767b\u5f55\u65f6\u95f4
#history operate
#operate
log.operate.servicename=\u670d\u52a1
log.operate.message=\u6d88\u606f
log.operate.content=\u5185\u5bb9
log.operate.messageType=\u6d88\u606f\u7c7b\u578b
log.operate.operateType=\u64cd\u4f5c\u7c7b\u578b
log.operate.username=\u64cd\u4f5c\u4eba
#history synchronizer
#synchronizer
log.synchronizer.id=\u7F16\u53F7
log.synchronizer.syncId=\u540C\u6B65\u5668\u7F16\u53F7
log.synchronizer.syncName=\u540C\u6B65\u5668
......@@ -531,7 +532,7 @@ log.synchronizer.objectType=\u5BF9\u8C61\u540D\u79F0
log.synchronizer.objectName=\u5BF9\u8C61\u540D\u79F0
log.synchronizer.syncTime=\u540C\u6B65\u65F6\u95F4
log.synchronizer.result=\u7ED3\u679C
#history connector
#connector
log.connector.id=\u7F16\u53F7
log.connector.conName=\u8FDE\u63A5\u5668
log.connector.conType=\u7C7B\u578B
......
......@@ -39,7 +39,7 @@
<input type="text" id="scheduler" name="scheduler" class="form-control" title="" value="${model.scheduler!}" />
</td>
</tr>
<#if "DINGDING"==model.sourceType || "WORKWEIXIN"==model.sourceType>
<#if "LDAP"!=model.sourceType && "MSAD"!=model.sourceType && "JDBC"!=model.sourceType>
<tr>
<th><@locale code="synchronizers.principal" /></th>
<td nowrap>
......@@ -141,6 +141,13 @@
</td>
</tr>
</#if>
<tr>
<th><@locale code="synchronizers.syncStartTime" /></th>
<td nowrap>
<input type="text" id="syncStartTime" name="syncStartTime" class="form-control" title="" value="${model.syncStartTime!}" />
</td>
</tr>
<tr>
<th><@locale code="synchronizers.resumeTime" /></th>
<td nowrap>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册