Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
H
hls-support-rlwx
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
rl
hls-support-rlwx
Commits
cfe7f71b
Commit
cfe7f71b
authored
Oct 21, 2025
by
lishiqing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
登录密码加密
parent
b8f935d3
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
719 additions
and
1 deletion
+719
-1
DefaultLoginAdaptor.java
...n/java/com/hand/hap/adaptor/impl/DefaultLoginAdaptor.java
+300
-0
RSAPasswordManager.java
...c/main/java/com/hand/hap/security/RSAPasswordManager.java
+25
-0
RSACoder.java
core/src/main/java/com/hand/hls/utils/RSACoder.java
+264
-0
standardSecurity.xml
core/src/main/resources/spring/standardSecurity.xml
+4
-1
login.html
core/src/main/webapp/WEB-INF/view/login.html
+125
-0
jsencrypt.min.js
core/src/main/webapp/lib/rsa/jsencrypt.min.js
+1
-0
No files found.
core/src/main/java/com/hand/hap/adaptor/impl/DefaultLoginAdaptor.java
0 → 100644
View file @
cfe7f71b
This diff is collapsed.
Click to expand it.
core/src/main/java/com/hand/hap/security/RSAPasswordManager.java
0 → 100644
View file @
cfe7f71b
package
com
.
hand
.
hap
.
security
;
import
com.hand.hap.mybatis.util.StringUtil
;
import
com.hand.hls.utils.RSACoder
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
public
class
RSAPasswordManager
extends
PasswordManager
{
public
static
Logger
logger
=
LoggerFactory
.
getLogger
(
RSAPasswordManager
.
class
);
public
boolean
matches
(
CharSequence
rawPassword
,
String
encodedPassword
)
{
if
(
StringUtil
.
isEmpty
(
encodedPassword
))
return
false
;
try
{
CharSequence
decrypt
=
RSACoder
.
encryptByPrivateKey
(
rawPassword
);
return
super
.
matches
(
decrypt
,
encodedPassword
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
logger
.
error
(
"decrypt password failed ,the exception is {}"
,
e
);
return
false
;
}
}
}
core/src/main/java/com/hand/hls/utils/RSACoder.java
0 → 100644
View file @
cfe7f71b
This diff is collapsed.
Click to expand it.
core/src/main/resources/spring/standardSecurity.xml
View file @
cfe7f71b
...
...
@@ -62,10 +62,13 @@
<!-- <authentication-provider ref="ldapAuthProvider" />-->
<!--标准登录验证-->
<authentication-provider
user-service-ref=
"customUserDetailsService"
>
<password-encoder
ref=
"
p
asswordManager"
/>
<password-encoder
ref=
"
RSAP
asswordManager"
/>
</authentication-provider>
</authentication-manager>
<beans:bean
id=
"RSAPasswordManager"
class=
"com.hand.hap.security.RSAPasswordManager"
parent=
"passwordManager"
>
</beans:bean>
<beans:bean
id=
"captchaVerifierFilter"
class=
"com.hand.hap.security.CaptchaVerifierFilter"
>
<beans:property
name=
"captchaField"
value=
"verifiCode"
/>
</beans:bean>
...
...
core/src/main/webapp/WEB-INF/view/login.html
0 → 100644
View file @
cfe7f71b
<!DOCTYPE html>
<!--[if IE 8]> <html lang="en" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!-->
<html>
<!--<![endif]-->
<head>
<meta
charset=
"utf-8"
/>
<title>
${SYS_TITLE!'Hand Application Platform'}
</title>
<meta
http-equiv=
"X-UA-Compatible"
content=
"IE=edge"
>
<meta
content=
"width=device-width, initial-scale=1"
name=
"viewport"
/>
<link
href=
"${base.contextPath}/lib/assets/global/plugins/bootstrap/css/bootstrap.min.css"
rel=
"stylesheet"
type=
"text/css"
/>
<link
href=
"${base.contextPath}/lib/font-awesome-4.6.3/css/font-awesome.css"
rel=
"stylesheet"
type=
"text/css"
/>
<link
href=
"${base.contextPath}/lib/assets/global/css/components.css"
rel=
"stylesheet"
id=
"style_components"
type=
"text/css"
/>
<link
href=
"${base.contextPath}/lib/assets/global/css/plugins.css"
rel=
"stylesheet"
type=
"text/css"
/>
<link
href=
"${base.contextPath}/lib/assets/pages/css/login-5.css"
rel=
"stylesheet"
type=
"text/css"
/>
<script
src=
"${base.contextPath}/lib/assets/global/plugins/jquery.min.js"
type=
"text/javascript"
></script>
<link
href=
"${base.contextPath}/resources/upload/favicon.png"
rel=
"shortcut icon"
/>
<script>
var
_baseContext
=
'${base.contextPath}'
</script>
<script
src=
"${base.contextPath}/lib/rsa/jsencrypt.min.js"
></script>
</head>
<body
class=
" login"
>
<script>
function
changeCaptchaCode
()
{
$
(
"#imgObj"
).
attr
(
"src"
,
'${base.contextPath}/verifiCode?_r='
+
Math
.
random
());
}
function
doLogin
()
{
var
rsakey
=
$
(
"#pubkey"
).
val
();
if
(
rsakey
)
{
var
encrypt
=
new
JSEncrypt
();
encrypt
.
setPublicKey
(
rsakey
);
var
pwd
=
$
(
"#password"
).
val
();
if
(
pwd
)
{
$
(
"#password"
).
val
(
encrypt
.
encrypt
(
pwd
));
$
(
"#login_form"
).
submit
();
}
else
{
alert
(
"请输入密码"
);
}
}
else
{
alert
(
"页面已经过期,请刷新后重试,原因:找不到rsakey"
);
}
}
</script>
<style>
.user-login-5
input
:-webkit-autofill
{
-webkit-box-shadow
:
0
0
0
1000px
white
inset
!important
;
}
</style>
<!-- BEGIN : LOGIN PAGE 5-1 -->
<div
class=
"user-login-5"
>
<script>
if
(
top
.
sessionExpiredLogin
){
top
.
sessionExpiredLogin
();
$
(
'.user-login-5'
).
hide
();
}
</script>
<div
class=
"row bs-reset"
>
<div
class=
"col-md-6 bs-reset"
>
<div
class=
"login-bg"
style=
"background-image:url(${base.contextPath}/lib/assets/pages/img/login/bg1.jpg)"
>
<img
class=
"login-logo"
src=
"${base.contextPath}/resources/upload/logo.png"
width=
"140"
/>
</div>
</div>
<div
class=
"col-md-6 login-container bs-reset"
>
<div
class=
"login-content"
>
<h1>
${SYS_TITLE!'Hand Application Platform'} Login
</h1>
<
#
if
msg
?
exists
>
<div
class=
"alert alert-danger"
>
<button
class=
"close"
data-close=
"alert"
></button>
<span>
${msg!}
</span>
</div>
</
#
if>
<form
id=
"login_form"
class=
"login-form"
action=
"login"
method=
"post"
autocomplete=
"off"
>
<input
type=
"password"
hidden=
""
>
<div
class=
"row"
>
<div
class=
"col-xs-12 col-sm-6"
>
<input
class=
"form-control form-control-solid placeholder-no-fix"
type=
"text"
autocomplete=
"off"
placeholder=
"<@spring.message "
user
.
username
"
/>
" name="username" />
</div>
<div
class=
"col-xs-12 col-sm-6"
>
<input
class=
"form-control form-control-solid placeholder-no-fix <#if code! == "
LOGIN_NOT_MATCH
"
>
error
</
#
if>
" placeholder="
<
@
spring
.
message
"
user
.
password
"
/>
" id="password" type="password" autocomplete="off" name="password"/>
<script
type=
"text/javascript"
>
$
(
'#password'
).
on
(
'focus'
,
function
(){
$
(
this
).
attr
(
'type'
,
'password'
);
})
</script>
</div>
</div>
<div
class=
"row"
>
<div
class=
"col-sm-6"
style=
"position:relative"
>
<
#
if
ENABLE_CAPTCHA
>
<input
class=
"form-control form-control-solid placeholder-no-fix <#if code! == 'CAPTCHA_INVALID'>error</#if>"
placeholder=
"<@spring.message 'user.verifiCode'/>"
type=
"text"
name=
"verifiCode"
/>
<img
id=
"imgObj"
title=
"<@spring.message 'sys.login.refreshverificationcode'/>"
src=
"${base.contextPath}/verifiCode"
style=
"cursor:pointer;position:absolute;right:15px;top:-20px"
onclick=
"changeCaptchaCode()"
/>
</
#
if>
</div>
<div
class=
"col-sm-6 text-right"
>
<!--<div class="forgot-password">-->
<!--<a href="javascript:;" id="forget-password" class="forget-password">忘记密码 ?</a>-->
<!--</div>-->
<button
class=
"btn blue"
onclick=
"doLogin()"
style=
"min-width:100px"
><
@
spring
.
message
"
hap
.
login
"
/></button>
</div>
</div>
<input
type=
"hidden"
id=
"pubkey"
name=
"pubkey"
value=
"${PUB_KEY}"
/>
</form>
</div>
<div
class=
"login-footer"
>
<div
class=
"row bs-reset"
>
<div
class=
"col-xs-12 bs-reset"
>
<div
class=
"login-copyright text-right"
>
<p>
Copyright © 1996 - 2017 上海汉得信息技术股份有限公司.
</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!--[if lt IE 9]>
<script src="${base.contextPath}/lib/assets/global/plugins/respond.min.js"></script>
<script src="${base.contextPath}/lib/assets/global/plugins/excanvas.min.js"></script>
<![endif]-->
<script
src=
"${base.contextPath}/lib//assets/global/plugins/backstretch/jquery.backstretch.min.js"
type=
"text/javascript"
></script>
<script
src=
"${base.contextPath}/lib/assets/pages/scripts/login-5.js"
type=
"text/javascript"
></script>
</body>
</html>
\ No newline at end of file
core/src/main/webapp/lib/rsa/jsencrypt.min.js
0 → 100644
View file @
cfe7f71b
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment