Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
midjourney-proxy
Overview
Overview
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
徐少华
midjourney-proxy
Commits
5f58f6e4
Commit
5f58f6e4
authored
Apr 17, 2020
by
吴博
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1002766 add cookie check
parent
175146f1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
3 deletions
+11
-3
PermissionException.java
...ava/com/pcloud/common/permission/PermissionException.java
+1
-1
Cookie.java
.../src/main/java/com/pcloud/common/utils/cookie/Cookie.java
+10
-2
No files found.
pcloud-common/src/main/java/com/pcloud/common/permission/PermissionException.java
View file @
5f58f6e4
...
...
@@ -8,7 +8,7 @@ import java.io.IOException;
* @创建时间:2016年5月27日,下午2:12:12
* @版本:1.0
*/
public
class
PermissionException
extends
IO
Exception
{
public
class
PermissionException
extends
Runtime
Exception
{
private
static
final
long
serialVersionUID
=
1336555490029071770L
;
/**
...
...
pcloud-common/src/main/java/com/pcloud/common/utils/cookie/Cookie.java
View file @
5f58f6e4
...
...
@@ -3,6 +3,7 @@
*/
package
com
.
pcloud
.
common
.
utils
.
cookie
;
import
com.pcloud.common.permission.PermissionException
;
import
java.io.UnsupportedEncodingException
;
import
java.net.URLDecoder
;
import
java.util.HashMap
;
...
...
@@ -157,7 +158,8 @@ public class Cookie {
String
[]
user
=
userInfoArry
[
i
].
split
(
"="
);
String
wechatUserId
=
user
[
user
.
length
-
1
];
userInfos
.
put
(
"wechatUserId"
,
StringUtil
.
isEmpty
(
wechatUserId
)
||
"undefined"
.
equalsIgnoreCase
(
wechatUserId
)
||
"null"
.
equalsIgnoreCase
(
wechatUserId
)
?
null
:
NumberUtil
.
toLong
(
wechatUserId
));
||
"null"
.
equalsIgnoreCase
(
wechatUserId
)
||
Cookie
.
_WECHAT_USER_ID
.
equalsIgnoreCase
(
wechatUserId
)
?
null
:
NumberUtil
.
toLong
(
wechatUserId
));
}
if
(
userInfoArry
[
i
].
contains
(
"partyId"
))
{
String
[]
party
=
userInfoArry
[
i
].
split
(
"="
);
...
...
@@ -266,6 +268,9 @@ public class Cookie {
||
"null"
.
equalsIgnoreCase
(
userLabel
)
?
null
:
userLabel
);
}
}
if
(!
userInfos
.
containsKey
(
Cookie
.
_WECHAT_USER_ID
)
||
null
==
userInfos
.
get
(
Cookie
.
_WECHAT_USER_ID
)
||
StringUtil
.
isEmpty
(
userInfos
.
get
(
Cookie
.
_WECHAT_USER_ID
).
toString
())){
throw
PermissionException
.
PERMISSION_USER_NOT_LOGIN
;
}
return
userInfos
;
}
...
...
@@ -278,6 +283,9 @@ public class Cookie {
*/
public
static
Long
getId
(
String
userInfo
,
String
type
)
throws
BizException
{
String
value
=
getString
(
userInfo
,
type
);
if
(
Cookie
.
_WECHAT_USER_ID
.
equalsIgnoreCase
(
type
)
&&
StringUtil
.
isEmpty
(
value
)){
throw
PermissionException
.
PERMISSION_USER_NOT_LOGIN
;
}
return
StringUtil
.
isEmpty
(
value
)
||
"undefined"
.
equalsIgnoreCase
(
value
)
||
"null"
.
equalsIgnoreCase
(
value
)
?
null
:
NumberUtil
.
toLong
(
value
);
}
...
...
@@ -308,7 +316,7 @@ public class Cookie {
if
(
userInfoArry
[
i
].
contains
(
type
))
{
String
[]
ids
=
userInfoArry
[
i
].
split
(
"="
);
String
id
=
ids
[
ids
.
length
-
1
];
return
StringUtil
.
isEmpty
(
id
)
||
"undefined"
.
equalsIgnoreCase
(
id
)
||
"null"
.
equalsIgnoreCase
(
id
)
?
null
:
id
;
return
StringUtil
.
isEmpty
(
id
)
||
"undefined"
.
equalsIgnoreCase
(
id
)
||
"null"
.
equalsIgnoreCase
(
id
)
||
type
.
equalsIgnoreCase
(
id
)
?
null
:
id
;
}
}
return
null
;
...
...
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