Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
yujianwangzivayy
MaxKey
提交
58fc6cc3
MaxKey
项目概览
yujianwangzivayy
/
MaxKey
与 Fork 源项目一致
Fork自
MaxKey单点登录官方(MaxKeyTop) / MaxKey
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
MaxKey
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
58fc6cc3
编写于
5月 10, 2020
作者:
MaxKey单点登录官方
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix
上级
600f7c98
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
168 addition
and
56 deletion
+168
-56
maxkey-authentications/src/main/java/org/maxkey/authn/support/socialsignon/AbstractSocialSignOnEndpoint.java
...hn/support/socialsignon/AbstractSocialSignOnEndpoint.java
+2
-2
maxkey-authentications/src/main/java/org/maxkey/authn/support/socialsignon/SocialSignOnEndpoint.java
...xkey/authn/support/socialsignon/SocialSignOnEndpoint.java
+10
-10
maxkey-authentications/src/main/java/org/maxkey/authn/support/socialsignon/service/JdbcSocialsAssociateService.java
...ort/socialsignon/service/JdbcSocialsAssociateService.java
+112
-0
maxkey-authentications/src/main/java/org/maxkey/authn/support/socialsignon/service/SocialSignOnUserTokenService.java
...rt/socialsignon/service/SocialSignOnUserTokenService.java
+0
-18
maxkey-authentications/src/main/java/org/maxkey/authn/support/socialsignon/service/SocialsAssociate.java
.../authn/support/socialsignon/service/SocialsAssociate.java
+2
-2
maxkey-authentications/src/main/java/org/maxkey/authn/support/socialsignon/service/SocialsAssociateService.java
...support/socialsignon/service/SocialsAssociateService.java
+18
-0
maxkey-core/src/main/java/org/maxkey/persistence/db/PasswordPolicyRowMapper.java
...va/org/maxkey/persistence/db/PasswordPolicyRowMapper.java
+18
-18
maxkey-web-maxkey/src/main/java/org/maxkey/web/contorller/SocialSignOnListController.java
...org/maxkey/web/contorller/SocialSignOnListController.java
+6
-6
未找到文件。
maxkey-authentications/src/main/java/org/maxkey/authn/support/socialsignon/AbstractSocialSignOnEndpoint.java
浏览文件 @
58fc6cc3
...
@@ -5,7 +5,7 @@ package org.maxkey.authn.support.socialsignon;
...
@@ -5,7 +5,7 @@ package org.maxkey.authn.support.socialsignon;
import
org.maxkey.authn.support.socialsignon.service.SocialSignOnProvider
;
import
org.maxkey.authn.support.socialsignon.service.SocialSignOnProvider
;
import
org.maxkey.authn.support.socialsignon.service.SocialSignOnProviderService
;
import
org.maxkey.authn.support.socialsignon.service.SocialSignOnProviderService
;
import
org.maxkey.authn.support.socialsignon.service.Social
SignOnUserToken
Service
;
import
org.maxkey.authn.support.socialsignon.service.Social
sAssociate
Service
;
import
org.maxkey.web.WebContext
;
import
org.maxkey.web.WebContext
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
...
@@ -53,7 +53,7 @@ public class AbstractSocialSignOnEndpoint {
...
@@ -53,7 +53,7 @@ public class AbstractSocialSignOnEndpoint {
protected
SocialSignOnProviderService
socialSignOnProviderService
;
protected
SocialSignOnProviderService
socialSignOnProviderService
;
@Autowired
@Autowired
protected
Social
SignOnUserTokenService
socialSignOnUserToken
Service
;
protected
Social
sAssociateService
socialsAssociate
Service
;
...
...
maxkey-authentications/src/main/java/org/maxkey/authn/support/socialsignon/SocialSignOnEndpoint.java
浏览文件 @
58fc6cc3
...
@@ -6,7 +6,7 @@ package org.maxkey.authn.support.socialsignon;
...
@@ -6,7 +6,7 @@ package org.maxkey.authn.support.socialsignon;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
org.maxkey.authn.realm.AbstractAuthenticationRealm
;
import
org.maxkey.authn.realm.AbstractAuthenticationRealm
;
import
org.maxkey.authn.support.socialsignon.service.Social
SignOnUserToken
;
import
org.maxkey.authn.support.socialsignon.service.Social
sAssociate
;
import
org.maxkey.constants.ConstantsLoginType
;
import
org.maxkey.constants.ConstantsLoginType
;
import
org.maxkey.web.WebContext
;
import
org.maxkey.web.WebContext
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
...
@@ -62,13 +62,13 @@ public class SocialSignOnEndpoint extends AbstractSocialSignOnEndpoint{
...
@@ -62,13 +62,13 @@ public class SocialSignOnEndpoint extends AbstractSocialSignOnEndpoint{
public
ModelAndView
unbind
(
HttpServletRequest
request
,
public
ModelAndView
unbind
(
HttpServletRequest
request
,
@PathVariable
String
provider
)
{
@PathVariable
String
provider
)
{
WebContext
.
setAttribute
(
SOCIALSIGNON_SESSION_REDIRECT_URI
,
request
.
getParameter
(
SOCIALSIGNON_REDIRECT_URI
));
WebContext
.
setAttribute
(
SOCIALSIGNON_SESSION_REDIRECT_URI
,
request
.
getParameter
(
SOCIALSIGNON_REDIRECT_URI
));
Social
SignOnUserToken
socialSignOnUser
=
new
SocialSignOnUserToken
();
Social
sAssociate
socialSignOnUser
=
new
SocialsAssociate
();
socialSignOnUser
.
setProvider
(
provider
);
socialSignOnUser
.
setProvider
(
provider
);
socialSignOnUser
.
setUid
(
WebContext
.
getUserInfo
().
getId
());
socialSignOnUser
.
setUid
(
WebContext
.
getUserInfo
().
getId
());
socialSignOnUser
.
setUsername
(
WebContext
.
getUserInfo
().
getUsername
());
socialSignOnUser
.
setUsername
(
WebContext
.
getUserInfo
().
getUsername
());
_logger
.
debug
(
"Social Sign On unbind "
+
provider
+
" from user "
+
WebContext
.
getUserInfo
().
getUsername
());
_logger
.
debug
(
"Social Sign On unbind "
+
provider
+
" from user "
+
WebContext
.
getUserInfo
().
getUsername
());
social
SignOnUserToken
Service
.
delete
(
socialSignOnUser
);
social
sAssociate
Service
.
delete
(
socialSignOnUser
);
if
(
WebContext
.
getAttribute
(
SOCIALSIGNON_SESSION_REDIRECT_URI
)!=
null
){
if
(
WebContext
.
getAttribute
(
SOCIALSIGNON_SESSION_REDIRECT_URI
)!=
null
){
return
WebContext
.
redirect
(
WebContext
.
getAttribute
(
SOCIALSIGNON_SESSION_REDIRECT_URI
).
toString
());
return
WebContext
.
redirect
(
WebContext
.
getAttribute
(
SOCIALSIGNON_SESSION_REDIRECT_URI
).
toString
());
...
@@ -92,7 +92,7 @@ public class SocialSignOnEndpoint extends AbstractSocialSignOnEndpoint{
...
@@ -92,7 +92,7 @@ public class SocialSignOnEndpoint extends AbstractSocialSignOnEndpoint{
this
.
provider
=
provider
;
this
.
provider
=
provider
;
this
.
authCallback
();
this
.
authCallback
();
_logger
.
debug
(
this
.
accountId
);
_logger
.
debug
(
this
.
accountId
);
Social
SignOnUserToken
socialSignOnUserToken
=
new
SocialSignOnUserToken
();
Social
sAssociate
socialSignOnUserToken
=
new
SocialsAssociate
();
socialSignOnUserToken
.
setProvider
(
provider
);
socialSignOnUserToken
.
setProvider
(
provider
);
socialSignOnUserToken
.
setSocialuid
(
this
.
accountId
);
socialSignOnUserToken
.
setSocialuid
(
this
.
accountId
);
...
@@ -117,21 +117,21 @@ public class SocialSignOnEndpoint extends AbstractSocialSignOnEndpoint{
...
@@ -117,21 +117,21 @@ public class SocialSignOnEndpoint extends AbstractSocialSignOnEndpoint{
}
}
public
boolean
socialBind
(
Social
SignOnUserToken
socialSignOnUserToken
){
public
boolean
socialBind
(
Social
sAssociate
socialSignOnUserToken
){
socialSignOnUserToken
.
setSocialUserInfo
(
accountJsonString
);
socialSignOnUserToken
.
setSocialUserInfo
(
accountJsonString
);
socialSignOnUserToken
.
setUid
(
WebContext
.
getUserInfo
().
getId
());
socialSignOnUserToken
.
setUid
(
WebContext
.
getUserInfo
().
getId
());
socialSignOnUserToken
.
setUsername
(
WebContext
.
getUserInfo
().
getUsername
());
socialSignOnUserToken
.
setUsername
(
WebContext
.
getUserInfo
().
getUsername
());
//socialSignOnUserToken.setAccessToken(JsonUtils.object2Json(accessToken));
//socialSignOnUserToken.setAccessToken(JsonUtils.object2Json(accessToken));
//socialSignOnUserToken.setExAttribute(JsonUtils.object2Json(accessToken.getResponseObject()));
//socialSignOnUserToken.setExAttribute(JsonUtils.object2Json(accessToken.getResponseObject()));
_logger
.
debug
(
"Social Bind : "
+
socialSignOnUserToken
);
_logger
.
debug
(
"Social Bind : "
+
socialSignOnUserToken
);
this
.
social
SignOnUserToken
Service
.
delete
(
socialSignOnUserToken
);
this
.
social
sAssociate
Service
.
delete
(
socialSignOnUserToken
);
this
.
social
SignOnUserToken
Service
.
insert
(
socialSignOnUserToken
);
this
.
social
sAssociate
Service
.
insert
(
socialSignOnUserToken
);
return
true
;
return
true
;
}
}
public
boolean
socialSignOn
(
Social
SignOnUserToken
socialSignOnUserToken
){
public
boolean
socialSignOn
(
Social
sAssociate
socialSignOnUserToken
){
socialSignOnUserToken
=
this
.
social
SignOnUserToken
Service
.
get
(
socialSignOnUserToken
);
socialSignOnUserToken
=
this
.
social
sAssociate
Service
.
get
(
socialSignOnUserToken
);
_logger
.
debug
(
"callback SocialSignOn User Token : "
+
socialSignOnUserToken
);
_logger
.
debug
(
"callback SocialSignOn User Token : "
+
socialSignOnUserToken
);
if
(
null
!=
socialSignOnUserToken
){
if
(
null
!=
socialSignOnUserToken
){
...
@@ -143,7 +143,7 @@ public class SocialSignOnEndpoint extends AbstractSocialSignOnEndpoint{
...
@@ -143,7 +143,7 @@ public class SocialSignOnEndpoint extends AbstractSocialSignOnEndpoint{
socialSignOnUserToken
.
setSocialUserInfo
(
accountJsonString
);
socialSignOnUserToken
.
setSocialUserInfo
(
accountJsonString
);
//socialSignOnUserToken.setExAttribute(JsonUtils.object2Json(accessToken.getResponseObject()));
//socialSignOnUserToken.setExAttribute(JsonUtils.object2Json(accessToken.getResponseObject()));
this
.
social
SignOnUserToken
Service
.
update
(
socialSignOnUserToken
);
this
.
social
sAssociate
Service
.
update
(
socialSignOnUserToken
);
}
}
}
else
{
}
else
{
...
...
maxkey-authentications/src/main/java/org/maxkey/authn/support/socialsignon/service/JdbcSocial
SignOnUserToken
Service.java
→
maxkey-authentications/src/main/java/org/maxkey/authn/support/socialsignon/service/JdbcSocial
sAssociate
Service.java
浏览文件 @
58fc6cc3
...
@@ -11,98 +11,98 @@ import org.slf4j.LoggerFactory;
...
@@ -11,98 +11,98 @@ import org.slf4j.LoggerFactory;
import
org.springframework.jdbc.core.JdbcTemplate
;
import
org.springframework.jdbc.core.JdbcTemplate
;
import
org.springframework.jdbc.core.RowMapper
;
import
org.springframework.jdbc.core.RowMapper
;
public
class
JdbcSocial
SignOnUserTokenService
implements
SocialSignOnUserToken
Service
{
public
class
JdbcSocial
sAssociateService
implements
SocialsAssociate
Service
{
private
static
final
Logger
_logger
=
LoggerFactory
.
getLogger
(
JdbcSocial
SignOnUserToken
Service
.
class
);
private
static
final
Logger
_logger
=
LoggerFactory
.
getLogger
(
JdbcSocial
sAssociate
Service
.
class
);
private
static
final
String
DEFAULT_DEFAULT_INSERT_STATEMENT
=
"INSERT INTO SOCIALS
IGNON_USERS_TOKEN
(ID, UID , USERNAME , PROVIDER , SOCIALUID , ACCESSTOKEN , SOCIALUSERINFO , EXATTRIBUTE )VALUES( ? , ? , ? , ? , ?, ? , ? , ?)"
;
private
static
final
String
DEFAULT_DEFAULT_INSERT_STATEMENT
=
"INSERT INTO SOCIALS
_ASSOCIATE
(ID, UID , USERNAME , PROVIDER , SOCIALUID , ACCESSTOKEN , SOCIALUSERINFO , EXATTRIBUTE )VALUES( ? , ? , ? , ? , ?, ? , ? , ?)"
;
private
static
final
String
DEFAULT_DEFAULT_SIGNON_SELECT_STATEMENT
=
"SELECT ID, UID , USERNAME , PROVIDER , SOCIALUID , ACCESSTOKEN , SOCIALUSERINFO , EXATTRIBUTE FROM SOCIALS
IGNON_USERS_TOKEN
WHERE PROVIDER = ? AND SOCIALUID = ?"
;
private
static
final
String
DEFAULT_DEFAULT_SIGNON_SELECT_STATEMENT
=
"SELECT ID, UID , USERNAME , PROVIDER , SOCIALUID , ACCESSTOKEN , SOCIALUSERINFO , EXATTRIBUTE FROM SOCIALS
_ASSOCIATE
WHERE PROVIDER = ? AND SOCIALUID = ?"
;
private
static
final
String
DEFAULT_DEFAULT_BIND_SELECT_STATEMENT
=
"SELECT ID, UID , USERNAME , PROVIDER , SOCIALUID , ACCESSTOKEN , SOCIALUSERINFO , EXATTRIBUTE FROM SOCIALS
IGNON_USERS_TOKEN
WHERE UID = ?"
;
private
static
final
String
DEFAULT_DEFAULT_BIND_SELECT_STATEMENT
=
"SELECT ID, UID , USERNAME , PROVIDER , SOCIALUID , ACCESSTOKEN , SOCIALUSERINFO , EXATTRIBUTE FROM SOCIALS
_ASSOCIATE
WHERE UID = ?"
;
private
static
final
String
DEFAULT_DEFAULT_DELETE_STATEMENT
=
"DELETE FROM SOCIALS
IGNON_USERS_TOKEN
WHERE UID = ? AND PROVIDER = ?"
;
private
static
final
String
DEFAULT_DEFAULT_DELETE_STATEMENT
=
"DELETE FROM SOCIALS
_ASSOCIATE
WHERE UID = ? AND PROVIDER = ?"
;
private
static
final
String
DEFAULT_DEFAULT_UPDATE_STATEMENT
=
"UPDATE SOCIALS
IGNON_USERS_TOKEN
SET ACCESSTOKEN = ? , SOCIALUSERINFO = ? , EXATTRIBUTE = ? ,UPDATEDDATE = ? WHERE ID = ?"
;
private
static
final
String
DEFAULT_DEFAULT_UPDATE_STATEMENT
=
"UPDATE SOCIALS
_ASSOCIATE
SET ACCESSTOKEN = ? , SOCIALUSERINFO = ? , EXATTRIBUTE = ? ,UPDATEDDATE = ? WHERE ID = ?"
;
private
final
JdbcTemplate
jdbcTemplate
;
private
final
JdbcTemplate
jdbcTemplate
;
public
JdbcSocial
SignOnUserToken
Service
(
JdbcTemplate
jdbcTemplate
)
{
public
JdbcSocial
sAssociate
Service
(
JdbcTemplate
jdbcTemplate
)
{
this
.
jdbcTemplate
=
jdbcTemplate
;
this
.
jdbcTemplate
=
jdbcTemplate
;
}
}
@Override
@Override
public
boolean
insert
(
Social
SignOnUserToken
socialSignOnUserToken
)
{
public
boolean
insert
(
Social
sAssociate
socialsAssociate
)
{
social
SignOnUserToken
.
setId
(
socialSignOnUserToken
.
generateId
());
social
sAssociate
.
setId
(
socialsAssociate
.
generateId
());
jdbcTemplate
.
update
(
DEFAULT_DEFAULT_INSERT_STATEMENT
,
jdbcTemplate
.
update
(
DEFAULT_DEFAULT_INSERT_STATEMENT
,
new
Object
[]
{
new
Object
[]
{
social
SignOnUserToken
.
getId
(),
social
sAssociate
.
getId
(),
social
SignOnUserToken
.
getUid
(),
social
sAssociate
.
getUid
(),
social
SignOnUserToken
.
getUsername
(),
social
sAssociate
.
getUsername
(),
social
SignOnUserToken
.
getProvider
(),
social
sAssociate
.
getProvider
(),
social
SignOnUserToken
.
getSocialuid
(),
social
sAssociate
.
getSocialuid
(),
social
SignOnUserToken
.
getAccessToken
(),
social
sAssociate
.
getAccessToken
(),
social
SignOnUserToken
.
getSocialUserInfo
(),
social
sAssociate
.
getSocialUserInfo
(),
social
SignOnUserToken
.
getExAttribute
()},
social
sAssociate
.
getExAttribute
()},
new
int
[]
{
Types
.
VARCHAR
,
Types
.
VARCHAR
,
Types
.
VARCHAR
,
Types
.
VARCHAR
,
Types
.
VARCHAR
,
Types
.
VARCHAR
,
Types
.
VARCHAR
,
Types
.
VARCHAR
});
new
int
[]
{
Types
.
VARCHAR
,
Types
.
VARCHAR
,
Types
.
VARCHAR
,
Types
.
VARCHAR
,
Types
.
VARCHAR
,
Types
.
VARCHAR
,
Types
.
VARCHAR
,
Types
.
VARCHAR
});
return
true
;
return
true
;
}
}
@Override
@Override
public
boolean
delete
(
Social
SignOnUserToken
socialSignOnUserToken
)
{
public
boolean
delete
(
Social
sAssociate
socialsAssociate
)
{
jdbcTemplate
.
update
(
DEFAULT_DEFAULT_DELETE_STATEMENT
,
jdbcTemplate
.
update
(
DEFAULT_DEFAULT_DELETE_STATEMENT
,
new
Object
[]
{
new
Object
[]
{
social
SignOnUserToken
.
getUid
(),
social
sAssociate
.
getUid
(),
social
SignOnUserToken
.
getProvider
()
social
sAssociate
.
getProvider
()
},
},
new
int
[]
{
Types
.
VARCHAR
,
Types
.
VARCHAR
});
new
int
[]
{
Types
.
VARCHAR
,
Types
.
VARCHAR
});
return
true
;
return
true
;
}
}
@Override
@Override
public
Social
SignOnUserToken
get
(
SocialSignOnUserToken
socialSignOnUserToken
)
{
public
Social
sAssociate
get
(
SocialsAssociate
socialsAssociate
)
{
List
<
Social
SignOnUserToken
>
listSocialSignOnUserToken
=
jdbcTemplate
.
query
(
List
<
Social
sAssociate
>
listsocialsAssociate
=
jdbcTemplate
.
query
(
DEFAULT_DEFAULT_SIGNON_SELECT_STATEMENT
,
DEFAULT_DEFAULT_SIGNON_SELECT_STATEMENT
,
new
Social
SignOnUserToken
RowMapper
(),
new
Social
sAssociate
RowMapper
(),
social
SignOnUserToken
.
getProvider
(),
social
sAssociate
.
getProvider
(),
social
SignOnUserToken
.
getSocialuid
());
social
sAssociate
.
getSocialuid
());
_logger
.
debug
(
"list
SocialSignOnUserToken "
+
listSocialSignOnUserToken
);
_logger
.
debug
(
"list
socialsAssociate "
+
listsocialsAssociate
);
return
(
list
SocialSignOnUserToken
.
size
()>
0
)?
listSocialSignOnUserToken
.
get
(
0
):
null
;
return
(
list
socialsAssociate
.
size
()>
0
)?
listsocialsAssociate
.
get
(
0
):
null
;
}
}
@Override
@Override
public
List
<
Social
SignOnUserToken
>
query
(
public
List
<
Social
sAssociate
>
query
(
Social
SignOnUserToken
socialSignOnUserToken
)
{
Social
sAssociate
socialsAssociate
)
{
List
<
Social
SignOnUserToken
>
listSocialSignOnUserToken
=
jdbcTemplate
.
query
(
List
<
Social
sAssociate
>
listsocialsAssociate
=
jdbcTemplate
.
query
(
DEFAULT_DEFAULT_BIND_SELECT_STATEMENT
,
DEFAULT_DEFAULT_BIND_SELECT_STATEMENT
,
new
Social
SignOnUserToken
RowMapper
(),
new
Social
sAssociate
RowMapper
(),
social
SignOnUserToken
.
getUid
());
social
sAssociate
.
getUid
());
_logger
.
debug
(
"query bind SocialSignOnUser "
+
list
SocialSignOnUserToken
);
_logger
.
debug
(
"query bind SocialSignOnUser "
+
list
socialsAssociate
);
return
list
SocialSignOnUserToken
;
return
list
socialsAssociate
;
}
}
@Override
@Override
public
boolean
update
(
Social
SignOnUserToken
socialSignOnUserToken
)
{
public
boolean
update
(
Social
sAssociate
socialsAssociate
)
{
jdbcTemplate
.
update
(
DEFAULT_DEFAULT_UPDATE_STATEMENT
,
jdbcTemplate
.
update
(
DEFAULT_DEFAULT_UPDATE_STATEMENT
,
new
Object
[]
{
social
SignOnUserToken
.
getAccessToken
(),
socialSignOnUserToken
.
getSocialUserInfo
(),
socialSignOnUserToken
.
getExAttribute
(),
new
Date
(),
socialSignOnUserToken
.
getId
()},
new
Object
[]
{
social
sAssociate
.
getAccessToken
(),
socialsAssociate
.
getSocialUserInfo
(),
socialsAssociate
.
getExAttribute
(),
new
Date
(),
socialsAssociate
.
getId
()},
new
int
[]
{
Types
.
VARCHAR
,
Types
.
VARCHAR
,
Types
.
VARCHAR
,
Types
.
TIMESTAMP
,
Types
.
VARCHAR
});
new
int
[]
{
Types
.
VARCHAR
,
Types
.
VARCHAR
,
Types
.
VARCHAR
,
Types
.
TIMESTAMP
,
Types
.
VARCHAR
});
return
false
;
return
false
;
}
}
private
final
class
Social
SignOnUserTokenRowMapper
implements
RowMapper
<
SocialSignOnUserToken
>
{
private
final
class
Social
sAssociateRowMapper
implements
RowMapper
<
SocialsAssociate
>
{
@Override
@Override
public
Social
SignOnUserToken
mapRow
(
ResultSet
rs
,
int
rowNum
)
public
Social
sAssociate
mapRow
(
ResultSet
rs
,
int
rowNum
)
throws
SQLException
{
throws
SQLException
{
Social
SignOnUserToken
socialSignOnUserToken
=
new
SocialSignOnUserToken
();
Social
sAssociate
socialsAssociate
=
new
SocialsAssociate
();
social
SignOnUserToken
.
setId
(
rs
.
getString
(
1
));
social
sAssociate
.
setId
(
rs
.
getString
(
1
));
social
SignOnUserToken
.
setUid
(
rs
.
getString
(
2
));
social
sAssociate
.
setUid
(
rs
.
getString
(
2
));
social
SignOnUserToken
.
setUsername
(
rs
.
getString
(
3
));
social
sAssociate
.
setUsername
(
rs
.
getString
(
3
));
social
SignOnUserToken
.
setProvider
(
rs
.
getString
(
4
));
social
sAssociate
.
setProvider
(
rs
.
getString
(
4
));
social
SignOnUserToken
.
setSocialuid
(
rs
.
getString
(
5
));
social
sAssociate
.
setSocialuid
(
rs
.
getString
(
5
));
social
SignOnUserToken
.
setAccessToken
(
rs
.
getString
(
6
));
social
sAssociate
.
setAccessToken
(
rs
.
getString
(
6
));
social
SignOnUserToken
.
setSocialUserInfo
(
rs
.
getString
(
7
));
social
sAssociate
.
setSocialUserInfo
(
rs
.
getString
(
7
));
social
SignOnUserToken
.
setExAttribute
(
rs
.
getString
(
8
));
social
sAssociate
.
setExAttribute
(
rs
.
getString
(
8
));
return
social
SignOnUserToken
;
return
social
sAssociate
;
}
}
}
}
...
...
maxkey-authentications/src/main/java/org/maxkey/authn/support/socialsignon/service/SocialSignOnUserTokenService.java
已删除
100644 → 0
浏览文件 @
600f7c98
package
org.maxkey.authn.support.socialsignon.service
;
import
java.util.List
;
public
interface
SocialSignOnUserTokenService
{
public
boolean
insert
(
SocialSignOnUserToken
socialSignOnUserToken
);
public
List
<
SocialSignOnUserToken
>
query
(
SocialSignOnUserToken
socialSignOnUserToken
);
public
SocialSignOnUserToken
get
(
SocialSignOnUserToken
socialSignOnUserToken
);
public
boolean
delete
(
SocialSignOnUserToken
socialSignOnUserToken
);
public
boolean
update
(
SocialSignOnUserToken
socialSignOnUserToken
);
}
maxkey-authentications/src/main/java/org/maxkey/authn/support/socialsignon/service/Social
SignOnUserToken
.java
→
maxkey-authentications/src/main/java/org/maxkey/authn/support/socialsignon/service/Social
sAssociate
.java
浏览文件 @
58fc6cc3
...
@@ -6,7 +6,7 @@ import org.apache.mybatis.jpa.persistence.JpaBaseDomain;
...
@@ -6,7 +6,7 @@ import org.apache.mybatis.jpa.persistence.JpaBaseDomain;
*
*
* @author Crystal.Sea
* @author Crystal.Sea
*/
*/
public
class
Social
SignOnUserToken
extends
JpaBaseDomain
{
public
class
Social
sAssociate
extends
JpaBaseDomain
{
/**
/**
*
*
...
@@ -21,7 +21,7 @@ public class SocialSignOnUserToken extends JpaBaseDomain {
...
@@ -21,7 +21,7 @@ public class SocialSignOnUserToken extends JpaBaseDomain {
private
String
accessToken
;
private
String
accessToken
;
private
String
exAttribute
;
private
String
exAttribute
;
public
Social
SignOnUserToken
()
{}
public
Social
sAssociate
()
{}
/**
/**
* @return the id
* @return the id
...
...
maxkey-authentications/src/main/java/org/maxkey/authn/support/socialsignon/service/SocialsAssociateService.java
0 → 100644
浏览文件 @
58fc6cc3
package
org.maxkey.authn.support.socialsignon.service
;
import
java.util.List
;
public
interface
SocialsAssociateService
{
public
boolean
insert
(
SocialsAssociate
socialsAssociate
);
public
List
<
SocialsAssociate
>
query
(
SocialsAssociate
socialsAssociate
);
public
SocialsAssociate
get
(
SocialsAssociate
socialsAssociate
);
public
boolean
delete
(
SocialsAssociate
socialsAssociate
);
public
boolean
update
(
SocialsAssociate
socialsAssociate
);
}
maxkey-core/src/main/java/org/maxkey/persistence/db/PasswordPolicyRowMapper.java
浏览文件 @
58fc6cc3
...
@@ -6,24 +6,24 @@ import java.sql.SQLException;
...
@@ -6,24 +6,24 @@ import java.sql.SQLException;
import
org.maxkey.domain.PasswordPolicy
;
import
org.maxkey.domain.PasswordPolicy
;
import
org.springframework.jdbc.core.RowMapper
;
import
org.springframework.jdbc.core.RowMapper
;
public
class
PasswordPolicyRowMapper
implements
RowMapper
<
PasswordPolicy
>
{
public
class
PasswordPolicyRowMapper
implements
RowMapper
<
PasswordPolicy
>
{
@Override
@Override
public
PasswordPolicy
mapRow
(
ResultSet
rs
,
int
rowNum
)
throws
SQLException
{
public
PasswordPolicy
mapRow
(
ResultSet
rs
,
int
rowNum
)
throws
SQLException
{
PasswordPolicy
passwordPolicy
=
new
PasswordPolicy
();
PasswordPolicy
passwordPolicy
=
new
PasswordPolicy
();
passwordPolicy
.
setId
(
rs
.
getString
(
"ID"
));
passwordPolicy
.
setId
(
rs
.
getString
(
"ID"
));
passwordPolicy
.
setMinLength
(
rs
.
getInt
(
"MINLENGTH"
));
passwordPolicy
.
setMinLength
(
rs
.
getInt
(
"MINLENGTH"
));
passwordPolicy
.
setMaxLength
(
rs
.
getInt
(
"MAXLENGTH"
));
passwordPolicy
.
setMaxLength
(
rs
.
getInt
(
"MAXLENGTH"
));
passwordPolicy
.
setLowerCase
(
rs
.
getInt
(
"LOWERCASE"
));
passwordPolicy
.
setLowerCase
(
rs
.
getInt
(
"LOWERCASE"
));
passwordPolicy
.
setUpperCase
(
rs
.
getInt
(
"UPPERCASE"
));
passwordPolicy
.
setUpperCase
(
rs
.
getInt
(
"UPPERCASE"
));
passwordPolicy
.
setDigits
(
rs
.
getInt
(
"DIGITS"
));
passwordPolicy
.
setDigits
(
rs
.
getInt
(
"DIGITS"
));
passwordPolicy
.
setSpecialChar
(
rs
.
getInt
(
"SPECIALCHAR"
));
passwordPolicy
.
setSpecialChar
(
rs
.
getInt
(
"SPECIALCHAR"
));
passwordPolicy
.
setAttempts
(
rs
.
getInt
(
"ATTEMPTS"
));
passwordPolicy
.
setAttempts
(
rs
.
getInt
(
"ATTEMPTS"
));
passwordPolicy
.
setDuration
(
rs
.
getInt
(
"DURATION"
));
passwordPolicy
.
setDuration
(
rs
.
getInt
(
"DURATION"
));
passwordPolicy
.
setExpiration
(
rs
.
getInt
(
"EXPIRATION"
));
passwordPolicy
.
setExpiration
(
rs
.
getInt
(
"EXPIRATION"
));
passwordPolicy
.
setUsername
(
rs
.
getInt
(
"USERNAME"
));
passwordPolicy
.
setUsername
(
rs
.
getInt
(
"USERNAME"
));
passwordPolicy
.
setSimplePasswords
(
rs
.
getString
(
"SIMPLEPASSWORDS"
));
passwordPolicy
.
setSimplePasswords
(
rs
.
getString
(
"SIMPLEPASSWORDS"
));
return
passwordPolicy
;
return
passwordPolicy
;
}
}
}
}
maxkey-web-maxkey/src/main/java/org/maxkey/web/contorller/SocialSignOnListController.java
浏览文件 @
58fc6cc3
...
@@ -5,8 +5,8 @@ import java.util.List;
...
@@ -5,8 +5,8 @@ import java.util.List;
import
org.maxkey.authn.support.socialsignon.service.SocialSignOnProvider
;
import
org.maxkey.authn.support.socialsignon.service.SocialSignOnProvider
;
import
org.maxkey.authn.support.socialsignon.service.SocialSignOnProviderService
;
import
org.maxkey.authn.support.socialsignon.service.SocialSignOnProviderService
;
import
org.maxkey.authn.support.socialsignon.service.Social
SignOnUserToken
;
import
org.maxkey.authn.support.socialsignon.service.Social
sAssociate
;
import
org.maxkey.authn.support.socialsignon.service.Social
SignOnUserToken
Service
;
import
org.maxkey.authn.support.socialsignon.service.Social
sAssociate
Service
;
import
org.maxkey.config.ApplicationConfig
;
import
org.maxkey.config.ApplicationConfig
;
import
org.maxkey.web.WebContext
;
import
org.maxkey.web.WebContext
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
...
@@ -27,7 +27,7 @@ public class SocialSignOnListController {
...
@@ -27,7 +27,7 @@ public class SocialSignOnListController {
SocialSignOnProviderService
socialSignOnProviderService
;
SocialSignOnProviderService
socialSignOnProviderService
;
@Autowired
@Autowired
protected
Social
SignOnUserToken
Service
socialSignOnUserService
;
protected
Social
sAssociate
Service
socialSignOnUserService
;
@Autowired
@Autowired
@Qualifier
(
"applicationConfig"
)
@Qualifier
(
"applicationConfig"
)
...
@@ -40,9 +40,9 @@ public class SocialSignOnListController {
...
@@ -40,9 +40,9 @@ public class SocialSignOnListController {
if
(
applicationConfig
.
getLoginConfig
().
isSocialSignOn
()){
if
(
applicationConfig
.
getLoginConfig
().
isSocialSignOn
()){
List
<
SocialSignOnProvider
>
listSocialSignOnProvider
=
socialSignOnProviderService
.
getSocialSignOnProviders
();
List
<
SocialSignOnProvider
>
listSocialSignOnProvider
=
socialSignOnProviderService
.
getSocialSignOnProviders
();
Social
SignOnUserToken
socialSignOnUser
=
new
SocialSignOnUserToken
();
Social
sAssociate
socialSignOnUser
=
new
SocialsAssociate
();
socialSignOnUser
.
setUid
(
WebContext
.
getUserInfo
().
getId
());
socialSignOnUser
.
setUid
(
WebContext
.
getUserInfo
().
getId
());
List
<
Social
SignOnUserToken
>
listSocialSignOnUserToken
=
socialSignOnUserService
.
query
(
socialSignOnUser
);
List
<
Social
sAssociate
>
listSocialSignOnUserToken
=
socialSignOnUserService
.
query
(
socialSignOnUser
);
List
<
SocialSignOnProvider
>
listBindSocialSignOnProvider
=
new
ArrayList
<
SocialSignOnProvider
>();
List
<
SocialSignOnProvider
>
listBindSocialSignOnProvider
=
new
ArrayList
<
SocialSignOnProvider
>();
_logger
.
debug
(
"list SocialSignOnProvider : "
+
listSocialSignOnProvider
);
_logger
.
debug
(
"list SocialSignOnProvider : "
+
listSocialSignOnProvider
);
_logger
.
debug
(
"list SocialSignOnUserToken : "
+
listSocialSignOnUserToken
);
_logger
.
debug
(
"list SocialSignOnUserToken : "
+
listSocialSignOnUserToken
);
...
@@ -51,7 +51,7 @@ public class SocialSignOnListController {
...
@@ -51,7 +51,7 @@ public class SocialSignOnListController {
socialSignOnProvider
.
setProvider
(
ssop
.
getProvider
());
socialSignOnProvider
.
setProvider
(
ssop
.
getProvider
());
socialSignOnProvider
.
setProviderName
(
ssop
.
getProviderName
());
socialSignOnProvider
.
setProviderName
(
ssop
.
getProviderName
());
socialSignOnProvider
.
setIcon
(
ssop
.
getIcon
());
socialSignOnProvider
.
setIcon
(
ssop
.
getIcon
());
for
(
Social
SignOnUserToken
ssout
:
listSocialSignOnUserToken
){
for
(
Social
sAssociate
ssout
:
listSocialSignOnUserToken
){
if
(
ssout
.
getProvider
().
equals
(
ssop
.
getProvider
())){
if
(
ssout
.
getProvider
().
equals
(
ssop
.
getProvider
())){
socialSignOnProvider
.
setUserBind
(
true
);
socialSignOnProvider
.
setUserBind
(
true
);
_logger
.
debug
(
"binded provider : "
+
ssout
.
getProvider
());
_logger
.
debug
(
"binded provider : "
+
ssout
.
getProvider
());
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录