Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
long-tern-care-service
Project
Project
Details
Activity
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
hubin
long-tern-care-service
Commits
d1f18992
Commit
d1f18992
authored
Feb 08, 2023
by
maqing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
RSA密码加密
parent
d7fa84c9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
3 additions
and
12 deletions
+3
-12
AuthController.java
...main/java/com/hungraim/ltc/controller/AuthController.java
+3
-2
PublicKeyController.java
...java/com/hungraim/ltc/controller/PublicKeyController.java
+0
-10
CsoftSecurityUtil.java
...rc/main/java/com/hungraim/ltc/util/CsoftSecurityUtil.java
+0
-0
No files found.
auth-service/src/main/java/com/hungraim/ltc/controller/AuthController.java
View file @
d1f18992
...
...
@@ -8,6 +8,7 @@ import org.springframework.security.oauth2.common.OAuth2AccessToken;
import
org.springframework.security.oauth2.provider.endpoint.TokenEndpoint
;
import
org.springframework.web.bind.annotation.*
;
import
java.security.NoSuchAlgorithmException
;
import
java.security.Principal
;
import
java.util.Map
;
...
...
@@ -26,7 +27,7 @@ public class AuthController {
@SneakyThrows
public
Result
<
OAuth2AccessToken
>
postAccessToken
(
Principal
principal
,
@RequestParam
Map
<
String
,
String
>
parameters
)
{
String
password
=
parameters
.
get
(
"password"
);
String
decrypt
=
CsoftSecurityUtil
.
decrypt
(
password
);
String
decrypt
=
CsoftSecurityUtil
.
decrypt
RSADefault
(
password
);
parameters
.
put
(
"password"
,
decrypt
);
OAuth2AccessToken
oAuth2AccessToken
=
tokenEndpoint
.
postAccessToken
(
principal
,
parameters
).
getBody
();
return
Result
.
success
(
oAuth2AccessToken
);
...
...
@@ -38,7 +39,7 @@ public class AuthController {
*/
@GetMapping
(
"/genKeyPair"
)
public
Result
<
String
>
genKeyPair
()
{
Map
keyMap
=
CsoftSecurityUtil
.
genKeyPair
();
Map
keyMap
=
CsoftSecurityUtil
.
createKeyPairs
();
return
Result
.
success
(
keyMap
.
get
(
0
).
toString
());
}
...
...
auth-service/src/main/java/com/hungraim/ltc/controller/PublicKeyController.java
View file @
d1f18992
...
...
@@ -33,14 +33,4 @@ public class PublicKeyController {
return
new
JWKSet
(
key
).
toJSONObject
();
}
/**
* 获取公钥
* @return
*/
@GetMapping
(
"/genKeyPair"
)
public
Result
<
String
>
genKeyPair
()
{
Map
keyMap
=
CsoftSecurityUtil
.
genKeyPair
();
return
Result
.
success
(
keyMap
.
get
(
0
).
toString
());
}
}
common/common-core/src/main/java/com/hungraim/ltc/util/CsoftSecurityUtil.java
View file @
d1f18992
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