Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
smileNicky
jeeplatform
提交
3ecd7b6b
J
jeeplatform
项目概览
smileNicky
/
jeeplatform
通知
8
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
5
列表
看板
标记
里程碑
合并请求
4
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
J
jeeplatform
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
5
Issue
5
列表
看板
标记
里程碑
合并请求
4
合并请求
4
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
3ecd7b6b
编写于
5月 19, 2019
作者:
N
Nicky.Ma
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'origin/1.0.0' into develop
上级
734b3fba
87eae64b
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
82 addition
and
0 deletion
+82
-0
code/jeeplatform-sso/src/main/java/org/muses/jeeplatform/cas/authentication/security/providers/CostomUsernamePasswordAuthentication.java
...urity/providers/CostomUsernamePasswordAuthentication.java
+45
-0
code/jeeplatform-sso/src/main/webapp/WEB-INF/deployerConfigContext.xml
...orm-sso/src/main/webapp/WEB-INF/deployerConfigContext.xml
+27
-0
code/jeeplatform-sso/src/main/webapp/cas.properties
code/jeeplatform-sso/src/main/webapp/cas.properties
+10
-0
未找到文件。
code/jeeplatform-sso/src/main/java/org/muses/jeeplatform/cas/authentication/security/providers/CostomUsernamePasswordAuthentication.java
0 → 100644
浏览文件 @
3ecd7b6b
package
org.muses.jeeplatform.cas.authentication.security.providers
;
import
org.jasig.cas.authentication.HandlerResult
;
import
org.jasig.cas.authentication.PreventedException
;
import
org.jasig.cas.authentication.UsernamePasswordCredential
;
import
org.jasig.cas.authentication.handler.support.AbstractUsernamePasswordAuthenticationHandler
;
import
javax.security.auth.login.FailedLoginException
;
import
java.security.GeneralSecurityException
;
/**
* <pre>
* CAS单点登录验证
* </pre>
*
* @author nicky.ma
* <pre>
* 修改记录
* 修改后版本: 修改人: 修改日期: 2019年05月19日 修改内容:
* </pre>
*/
public
class
CostomUsernamePasswordAuthentication
extends
AbstractUsernamePasswordAuthenticationHandler
{
@Override
protected
HandlerResult
authenticateUsernamePasswordInternal
(
UsernamePasswordCredential
usernamePasswordCredential
)
throws
GeneralSecurityException
,
PreventedException
{
if
(
usernamePasswordCredential
==
null
)
{
throw
new
FailedLoginException
(
"No user can be accepted because none is defined"
);
}
return
doAuthentication
(
usernamePasswordCredential
);
}
/**
* 用户密码验证
* @param credential
* @return
*/
private
HandlerResult
doAuthentication
(
UsernamePasswordCredential
credential
)
{
String
username
=
credential
.
getUsername
();
String
password
=
credential
.
getPassword
();
String
fullUserName
=
username
;
return
createHandlerResult
(
credential
,
this
.
principalFactory
.
createPrincipal
(
username
),
null
);
}
}
code/jeeplatform-sso/src/main/webapp/WEB-INF/deployerConfigContext.xml
浏览文件 @
3ecd7b6b
...
...
@@ -15,10 +15,37 @@
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd"
>
<bean
id=
"dataSource"
class=
"com.alibaba.druid.pool.DruidDataSource"
init-method=
"init"
destroy-method=
"close"
>
<property
name=
"url"
value=
"${platform.jdbc.jdbcUrl}"
/>
<property
name=
"username"
value=
"${platform.jdbc.username}"
/>
<property
name=
"password"
value=
"${platform.jdbc.password}"
/>
<property
name=
"initialSize"
value=
"${platform.jdbc.initialSize}"
/>
<property
name=
"minIdle"
value=
"${platform.jdbc.minIdle}"
/>
<property
name=
"maxActive"
value=
"${platform.jdbc.maxActive}"
/>
<property
name=
"maxWait"
value=
"60000"
/>
<!-- 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 -->
<property
name=
"timeBetweenEvictionRunsMillis"
value=
"60000"
/>
<!-- 配置一个连接在池中最小生存的时间,单位是毫秒 -->
<property
name=
"minEvictableIdleTimeMillis"
value=
"300000"
/>
<property
name=
"validationQuery"
value=
"SELECT 1"
/>
<property
name=
"testWhileIdle"
value=
"true"
/>
<property
name=
"testOnBorrow"
value=
"false"
/>
<property
name=
"testOnReturn"
value=
"false"
/>
<!-- 打开removeAbandoned功能 -->
<property
name=
"removeAbandoned"
value=
"true"
/>
<property
name=
"removeAbandonedTimeout"
value=
"1800"
/>
<!-- 1800秒,也就是30分钟 -->
<property
name=
"logAbandoned"
value=
"true"
/>
<!-- 打开PSCache,并且指定每个连接上PSCache的大小,mysql 不使用 -->
<property
name=
"poolPreparedStatements"
value=
"false"
/>
<property
name=
"filters"
value=
"config"
/>
<property
name=
"connectionProperties"
value=
"config.decrypt=true;config.decrypt.key=${platform.jdbc.publickey};druid.stat.slowSqlMillis=200;druid.stat.logSlowSql=true"
/>
</bean>
<util:map
id=
"authenticationHandlersResolvers"
>
<entry
key-ref=
"proxyAuthenticationHandler"
value-ref=
"proxyPrincipalResolver"
/>
<entry
key-ref=
"primaryAuthenticationHandler"
value-ref=
"primaryPrincipalResolver"
/>
<!--<entry key-ref="costomUsernamePasswordAuthentication" value-ref="primaryPrincipalResolver" />-->
</util:map>
<util:list
id=
"authenticationMetadataPopulators"
>
...
...
code/jeeplatform-sso/src/main/webapp/cas.properties
浏览文件 @
3ecd7b6b
server.name
=
http://localhost:8080
server.prefix
=
${server.name}/cas
##
# Datasource config
platform.jdbc.jdbcUrl
=
jdbc:mysql://127.0.0.1:3306/jeeplatform?autoReconnect=true&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useSSL=false
platform.jdbc.username
=
root
platform.jdbc.password
=
root
platform.jdbc.publickey
=
MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAKZijIzzXp1dyksL1ZSejBmuVz1Y0vgiQVbcQ/13p4pwHRo8gU3pd6YaWutOlBTEWvHBbnGxIdnrhxnQZGwU1O0CAwEAAQ==
platform.jdbc.initialSize
=
10
platform.jdbc.minIdle
=
10
platform.jdbc.maxActive
=
50
# security configuration based on IP address to access the /status and /statistics pages
# cas.securityContext.adminpages.ip=127\.0\.0\.1
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录