change Social Sign On use JustAuth

change Social Sign On use JustAuth,
dingtalk
sinaweibo
is tested
This commit is contained in:
shimingxy
2020-02-05 19:42:35 +08:00
parent b7a0ecddc0
commit d294444352
20 changed files with 233 additions and 409 deletions

View File

@@ -31,13 +31,13 @@ public class IndexEndpoint {
_logger.debug("IndexEndpoint /forwardindex.");
ModelAndView modelAndView=new ModelAndView();
Integer passwordSetType=(Integer)WebContext.getSession().getAttribute(WebConstants.CURRENT_LOGIN_USER_PASSWORD_SET_TYPE);
if(passwordSetType==PASSWORDSETTYPE.PASSWORD_NORMAL){
if(passwordSetType==null || passwordSetType==PASSWORDSETTYPE.PASSWORD_NORMAL){
if(applicationConfig.getLoginConfig().getDefaultUri()!=null&&
!applicationConfig.getLoginConfig().getDefaultUri().equals("")){
if(applicationConfig.getLoginConfig().getDefaultUri().startsWith("http")){
return WebContext.redirect(applicationConfig.getLoginConfig().getDefaultUri());
}
return WebContext.forward(applicationConfig.getLoginConfig().getDefaultUri());
return WebContext.redirect(applicationConfig.getLoginConfig().getDefaultUri());
}
modelAndView.setViewName("index");
return modelAndView;

View File

@@ -76,3 +76,64 @@ config.oidc.metadata.authorizationEndpoint=http://${config.server.name}/maxkey/o
config.oidc.metadata.tokenEndpoint=http://${config.server.name}/maxkey/oauth/v20/token
config.oidc.metadata.userinfoEndpoint=http://${config.server.name}/maxkey/api/connect/userinfo
#############################################################################
############################################################################
# Social Sign On Configuration #
#you config client.id & client.secret only
############################################################################
############################################################################
#sina weibo
config.socialsignon.sinaweibo.provider=sinaweibo
config.socialsignon.sinaweibo.provider.name=\u65B0\u6D6A\u5FAE\u535A
config.socialsignon.sinaweibo.icon=images/social/sinaweibo.png
config.socialsignon.sinaweibo.client.id=3379757634
config.socialsignon.sinaweibo.client.secret=1adfdf9800299037bcab9d1c238664ba
config.socialsignon.sinaweibo.account.id=id
config.socialsignon.sinaweibo.sortorder=1
#Google
config.socialsignon.google.provider=google
config.socialsignon.google.provider.name=Google
config.socialsignon.google.icon=images/social/google.png
config.socialsignon.google.client.id=519914515488.apps.googleusercontent.com
config.socialsignon.google.client.secret=3aTW3Iw7e11QqMnHxciCaXTt
config.socialsignon.google.account.id=id
config.socialsignon.google.sortorder=2
#QQ
config.socialsignon.qq.provider=qq
config.socialsignon.qq.provider.name=QQ
config.socialsignon.qq.icon=images/social/qq.png
config.socialsignon.qq.client.id=101224990
config.socialsignon.qq.client.secret=09d7481b68d888f01831e3ef7c1c3015
config.socialsignon.qq.account.id=openid
config.socialsignon.qq.sortorder=4
#dingtalk
config.socialsignon.dingtalk.provider=dingtalk
config.socialsignon.dingtalk.provider.name=dingtalk
config.socialsignon.dingtalk.icon=images/social/dingtalk.png
config.socialsignon.dingtalk.client.id=dingoawf2jyiwh2uzqnphg
config.socialsignon.dingtalk.client.secret=Crm7YJbMKfRlvG2i1SHpg4GHVpqF_oXiEjhmRQyiSiuzNRWpbFh9i0UjDTfhOoN9
config.socialsignon.dingtalk.account.id=openid
config.socialsignon.dingtalk.sortorder=4
#Windows Live
config.socialsignon.live.provider=Windows
config.socialsignon.live.provider.name=Windows Live
config.socialsignon.live.icon=images/social/live.png
config.socialsignon.live.client.id=00000000401129A4
config.socialsignon.live.client.secret=Kx-OAmHaoqG5vcitm3-TASOSZD1ebu64
config.socialsignon.live.account.id=id
config.socialsignon.live.sortorder=5
#facebook
config.socialsignon.facebook.provider=facebook
config.socialsignon.facebook.provider.name=facebook
config.socialsignon.facebook.icon=images/social/facebook.png
config.socialsignon.facebook.client.id=appKey
config.socialsignon.facebook.client.secret=appSecret
config.socialsignon.facebook.account.id=id
config.socialsignon.facebook.sortorder=7

View File

@@ -1,83 +0,0 @@
############################################################################
# MaxKey
############################################################################
# Social Sign On Configuration #
#you config client.id & client.secret only
############################################################################
############################################################################
#sina weibo
config.socialsignon.sinaweibo.provider=sinaweibo
config.socialsignon.sinaweibo.provider.name=\u65B0\u6D6A\u5FAE\u535A
config.socialsignon.sinaweibo.icon=images/social/sinaweibo.png
config.socialsignon.sinaweibo.client.id=3379757634
config.socialsignon.sinaweibo.client.secret=1adfdf9800299037bcab9d1c238664ba
config.socialsignon.sinaweibo.authorize.url=https://api.weibo.com/oauth2/authorize?client_id=%s&redirect_uri=%s&response_type=code
config.socialsignon.sinaweibo.accesstoken.url=https://api.weibo.com/oauth2/access_token
config.socialsignon.sinaweibo.accesstoken.method=POST
config.socialsignon.sinaweibo.scope=all
config.socialsignon.sinaweibo.verifier.code=code
config.socialsignon.sinaweibo.account.url=https://api.weibo.com/2/users/show.json
config.socialsignon.sinaweibo.account.id=id
config.socialsignon.sinaweibo.sortorder=1
#Google
config.socialsignon.google.provider=google
config.socialsignon.google.provider.name=Google
config.socialsignon.google.icon=images/social/google.png
config.socialsignon.google.client.id=519914515488.apps.googleusercontent.com
config.socialsignon.google.client.secret=3aTW3Iw7e11QqMnHxciCaXTt
config.socialsignon.google.authorize.url=https://accounts.google.com/o/oauth2/auth?client_id=%s&redirect_uri=%s&response_type=code
config.socialsignon.google.accesstoken.url=https://accounts.google.com/o/oauth2/token?access_type=offline
config.socialsignon.google.accesstoken.method=POST
config.socialsignon.google.scope=openid email profile
#config.socialsignon.google.scope=https://www.googleapis.com/auth/userinfo.email
config.socialsignon.google.verifier.code=code
config.socialsignon.google.account.url=https://www.googleapis.com/plus/v1/people/me
config.socialsignon.google.account.id=id
config.socialsignon.google.sortorder=2
#QQ
config.socialsignon.qq.provider=qq
config.socialsignon.qq.provider.name=QQ
config.socialsignon.qq.icon=images/social/qq.png
config.socialsignon.qq.client.id=101224990
config.socialsignon.qq.client.secret=09d7481b68d888f01831e3ef7c1c3015
config.socialsignon.qq.authorize.url=https://graph.qq.com/oauth2.0/authorize?client_id=%s&redirect_uri=%s&response_type=code
config.socialsignon.qq.accesstoken.url=https://graph.qq.com/oauth2.0/token
config.socialsignon.qq.accesstoken.method=POST
config.socialsignon.qq.scope=read
config.socialsignon.qq.verifier.code=code
config.socialsignon.qq.account.url=https://graph.qq.com/oauth2.0/me
config.socialsignon.qq.account.id=openid
config.socialsignon.qq.sortorder=4
#Windows Live
config.socialsignon.live.provider=live
config.socialsignon.live.provider.name=Windows Live
config.socialsignon.live.icon=images/social/live.png
config.socialsignon.live.client.id=00000000401129A4
config.socialsignon.live.client.secret=Kx-OAmHaoqG5vcitm3-TASOSZD1ebu64
config.socialsignon.live.authorize.url=https://login.live.com/oauth20_authorize.srf?client_id=%s&redirect_uri=%s&response_type=code
config.socialsignon.live.accesstoken.url=https://login.live.com/oauth20_token.srf
config.socialsignon.live.accesstoken.method=GET
config.socialsignon.live.scope=wl.basic
config.socialsignon.live.verifier.code=code
config.socialsignon.live.account.url=https://apis.live.net/v5.0/me
config.socialsignon.live.account.id=id
config.socialsignon.live.sortorder=5
#facebook
config.socialsignon.facebook.provider=facebook
config.socialsignon.facebook.provider.name=facebook
config.socialsignon.facebook.icon=images/social/facebook.png
config.socialsignon.facebook.client.id=appKey
config.socialsignon.facebook.client.secret=appSecret
config.socialsignon.facebook.authorize.url=https://www.facebook.com/dialog/oauth?client_id=%s&redirect_uri=%s&response_type=code
config.socialsignon.facebook.accesstoken.url=https://graph.facebook.com/oauth/access_token
config.socialsignon.facebook.accesstoken.method=GET
config.socialsignon.facebook.scope=read
config.socialsignon.facebook.verifier.code=code
config.socialsignon.facebook.account.url=https://graph.facebook.com/me
config.socialsignon.facebook.account.id=id
config.socialsignon.facebook.sortorder=7

View File

@@ -28,13 +28,6 @@
<property name="icon" value="${config.socialsignon.sinaweibo.icon}"/>
<property name="clientId" value="${config.socialsignon.sinaweibo.client.id}"/>
<property name="clientSecret" value="${config.socialsignon.sinaweibo.client.secret}"/>
<property name="authorizeUrl" value="${config.socialsignon.sinaweibo.authorize.url}"/>
<property name="accessTokenUrl" value="${config.socialsignon.sinaweibo.accesstoken.url}"/>
<property name="accessTokenMethod" value="${config.socialsignon.sinaweibo.accesstoken.method}"/>
<property name="scope" value="${config.socialsignon.sinaweibo.scope}"/>
<property name="verifierCode" value="${config.socialsignon.sinaweibo.verifier.code}"/>
<property name="accountUrl" value="${config.socialsignon.sinaweibo.account.url}"/>
<property name="accountId" value="${config.socialsignon.sinaweibo.account.id}"/>
<property name="sortOrder" value="${config.socialsignon.sinaweibo.sortorder}"/>
</bean>
@@ -44,13 +37,6 @@
<property name="icon" value="${config.socialsignon.google.icon}"/>
<property name="clientId" value="${config.socialsignon.google.client.id}"/>
<property name="clientSecret" value="${config.socialsignon.google.client.secret}"/>
<property name="authorizeUrl" value="${config.socialsignon.google.authorize.url}"/>
<property name="accessTokenUrl" value="${config.socialsignon.google.accesstoken.url}"/>
<property name="accessTokenMethod" value="${config.socialsignon.google.accesstoken.method}"/>
<property name="scope" value="${config.socialsignon.google.scope}"/>
<property name="verifierCode" value="${config.socialsignon.google.verifier.code}"/>
<property name="accountUrl" value="${config.socialsignon.google.account.url}"/>
<property name="accountId" value="${config.socialsignon.google.account.id}"/>
<property name="sortOrder" value="${config.socialsignon.google.sortorder}"/>
</bean>
@@ -60,13 +46,6 @@
<property name="icon" value="${config.socialsignon.qq.icon}"/>
<property name="clientId" value="${config.socialsignon.qq.client.id}"/>
<property name="clientSecret" value="${config.socialsignon.qq.client.secret}"/>
<property name="authorizeUrl" value="${config.socialsignon.qq.authorize.url}"/>
<property name="accessTokenUrl" value="${config.socialsignon.qq.accesstoken.url}"/>
<property name="accessTokenMethod" value="${config.socialsignon.qq.accesstoken.method}"/>
<property name="scope" value="${config.socialsignon.qq.scope}"/>
<property name="verifierCode" value="${config.socialsignon.qq.verifier.code}"/>
<property name="accountUrl" value="${config.socialsignon.qq.account.url}"/>
<property name="accountId" value="${config.socialsignon.qq.account.id}"/>
<property name="sortOrder" value="${config.socialsignon.qq.sortorder}"/>
</bean>
@@ -76,13 +55,6 @@
<property name="icon" value="${config.socialsignon.live.icon}"/>
<property name="clientId" value="${config.socialsignon.live.client.id}"/>
<property name="clientSecret" value="${config.socialsignon.live.client.secret}"/>
<property name="authorizeUrl" value="${config.socialsignon.live.authorize.url}"/>
<property name="accessTokenUrl" value="${config.socialsignon.live.accesstoken.url}"/>
<property name="accessTokenMethod" value="${config.socialsignon.live.accesstoken.method}"/>
<property name="scope" value="${config.socialsignon.live.scope}"/>
<property name="verifierCode" value="${config.socialsignon.live.verifier.code}"/>
<property name="accountUrl" value="${config.socialsignon.live.account.url}"/>
<property name="accountId" value="${config.socialsignon.live.account.id}"/>
<property name="sortOrder" value="${config.socialsignon.live.sortorder}"/>
</bean>
@@ -92,15 +64,16 @@
<property name="icon" value="${config.socialsignon.facebook.icon}"/>
<property name="clientId" value="${config.socialsignon.facebook.client.id}"/>
<property name="clientSecret" value="${config.socialsignon.facebook.client.secret}"/>
<property name="authorizeUrl" value="${config.socialsignon.facebook.authorize.url}"/>
<property name="accessTokenUrl" value="${config.socialsignon.facebook.accesstoken.url}"/>
<property name="accessTokenMethod" value="${config.socialsignon.facebook.accesstoken.method}"/>
<property name="scope" value="${config.socialsignon.facebook.scope}"/>
<property name="verifierCode" value="${config.socialsignon.facebook.verifier.code}"/>
<property name="accountUrl" value="${config.socialsignon.facebook.account.url}"/>
<property name="accountId" value="${config.socialsignon.facebook.account.id}"/>
<property name="sortOrder" value="${config.socialsignon.facebook.sortorder}"/>
</bean>
</bean>
<bean id="socialSignOndingtalk" class="org.maxkey.authn.support.socialsignon.service.SocialSignOnProvider">
<property name="provider" value="${config.socialsignon.dingtalk.provider}"/>
<property name="providerName" value="${config.socialsignon.dingtalk.provider.name}"/>
<property name="icon" value="${config.socialsignon.dingtalk.icon}"/>
<property name="clientId" value="${config.socialsignon.dingtalk.client.id}"/>
<property name="clientSecret" value="${config.socialsignon.dingtalk.client.secret}"/>
<property name="sortOrder" value="${config.socialsignon.dingtalk.sortorder}"/>
</bean>
<bean id="socialSignOnProviderService" class="org.maxkey.authn.support.socialsignon.service.SocialSignOnProviderService">
<property name="socialSignOnProviders" >
@@ -110,6 +83,8 @@
<ref bean="socialSignOnGoogle"/>
<ref bean="socialSignOnLive"/>
<ref bean="socialSignOnFacebook"/>
<ref bean="socialSignOndingtalk"/>
</list>
</property>
</bean>

View File

@@ -25,7 +25,6 @@
<value>classpath:config/applicationConfig.properties</value>
<value>classpath:config/applicationLogin.properties</value>
<value>classpath:config/applicationSaml.properties</value>
<value>classpath:config/applicationSocialSignOn.properties</value>
</list>
</property>
<property name="ignoreUnresolvablePlaceholders" value="true"/>

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB