Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
aserver
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
15所TongWeb
aserver
Commits
06a96460
Commit
06a96460
authored
Jun 28, 2021
by
dong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
后端单点登录sso地址的修改
parent
66ba8d97
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
2 deletions
+40
-2
SettingController.java
...ava/com/archser/aserver/controller/SettingController.java
+10
-1
UserController.java
...n/java/com/archser/aserver/controller/UserController.java
+27
-1
JwtInterceptor.java
.../java/com/archser/aserver/interceptor/JwtInterceptor.java
+3
-0
No files found.
src/main/java/com/archser/aserver/controller/SettingController.java
View file @
06a96460
...
...
@@ -10,6 +10,8 @@ import java.io.IOException;
import
java.io.InputStream
;
import
java.io.OutputStream
;
import
java.util.List
;
import
com.archser.aserver.interceptor.JwtInterceptor
;
import
com.archser.aserver.model.Config
;
import
com.archser.aserver.service.SystemService
;
import
com.archser.aserver.validator.SettingValidator
;
...
...
@@ -89,13 +91,18 @@ public class SettingController extends Controller {
// @Before(UnifiedErrorInterceptor.class)
public
void
sso
()
{
String
val
=
null
;
String
val2
=
null
;
String
listenprot
=
null
;
try
{
val
=
this
.
getConfig
(
"sso"
);
val2
=
this
.
getConfig
(
"ssotwo"
);
listenprot
=
this
.
getConfig
(
"listenprot"
);
val
=
"http://127.0.0.1:11028"
;
}
catch
(
Exception
e
)
{
this
.
renderJson
(
Ret
.
fail
(
"msg"
,
e
.
getMessage
()));
}
this
.
renderJson
(
Ret
.
ok
(
"sso"
,
val
));
this
.
renderJson
(
Ret
.
ok
(
"sso"
,
val
)
.
set
(
"ssotwo"
,
val2
).
set
(
"listenprot"
,
listenprot
)
);
}
/**
...
...
@@ -164,6 +171,8 @@ public class SettingController extends Controller {
* @throws Exception
*/
private
String
getConfig
(
String
name
)
throws
Exception
{
String
ip
=
JwtInterceptor
.
getIpAddr
(
getRequest
());
System
.
out
.
println
(
"ip->>>>"
+
ip
);
String
val
=
Db
.
queryStr
(
Db
.
getSql
(
"getConfigByName"
),
name
);
if
(
val
==
null
)
{
throw
new
Exception
(
"配置项不存在(name='"
+
name
+
"')"
);
...
...
src/main/java/com/archser/aserver/controller/UserController.java
View file @
06a96460
...
...
@@ -13,6 +13,7 @@ import java.util.*;
import
java.util.Map.Entry
;
import
javax.inject.Inject
;
import
com.archser.aserver.interceptor.JwtInterceptor
;
import
com.archser.aserver.model.Fond
;
import
com.archser.aserver.model.Organ
;
import
com.archser.aserver.model.User
;
...
...
@@ -63,7 +64,15 @@ public class UserController extends Controller {
user
.
put
(
"organ_name"
,
userFondOrgan
.
getName
());
}
}
this
.
renderJson
(
Ret
.
ok
(
"userInfo"
,
user
));
try
{
String
uiUrl
=
this
.
getConfig
(
"uiUrl"
);
String
listenprot
=
this
.
getConfig
(
"listenprot"
);
this
.
renderJson
(
Ret
.
ok
(
"userInfo"
,
user
).
set
(
"uiUrl"
,
uiUrl
).
set
(
"listenprot"
,
listenprot
));
}
catch
(
Exception
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
}
}
/**
...
...
@@ -198,5 +207,22 @@ public class UserController extends Controller {
public
String
image2Base64
(
byte
[]
image
)
{
return
Base64
.
encodeBase64String
(
image
);
}
/**
* 获取配置项目
*
* @param name
* @return
* @throws Exception
*/
private
String
getConfig
(
String
name
)
throws
Exception
{
String
ip
=
JwtInterceptor
.
getIpAddr
(
getRequest
());
System
.
out
.
println
(
"ip->>>>"
+
ip
);
String
val
=
Db
.
queryStr
(
Db
.
getSql
(
"getConfigByName"
),
name
);
if
(
val
==
null
)
{
throw
new
Exception
(
"配置项不存在(name='"
+
name
+
"')"
);
}
return
val
;
}
}
src/main/java/com/archser/aserver/interceptor/JwtInterceptor.java
View file @
06a96460
...
...
@@ -61,6 +61,9 @@ public class JwtInterceptor implements Interceptor {
.
setSigningKeyResolver
(
new
JwtSigningKeyResolver
())
// 解析jwt
.
parseClaimsJws
(
token
).
getBody
();
String
ip
=
getIpAddr
(
inv
.
getController
().
getRequest
());
System
.
out
.
println
(
"解析验证请求中的ip--->"
+
ip
);
System
.
out
.
println
(
"解析验证tooken中的ip--->"
+
claims
.
get
(
"ip"
));
// 验证IP
if
(!
filterIpAddress
(
getIpAddr
(
inv
.
getController
().
getRequest
()),
claims
.
get
(
"ip"
,
String
.
class
)))
{
return
false
;
...
...
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