Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
order-group
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
jenkins
order-group
Commits
c1c647ca
Commit
c1c647ca
authored
Apr 10, 2020
by
xiaoer.li@freemud.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change:订单和购物车channel=3 跳过鉴权
parent
98a38a33
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
8 deletions
+30
-8
order-application-service/src/main/java/cn/freemud/aop/WebAspect.java
+15
-4
shopping-cart-application-service/src/main/java/cn/freemud/aop/WebAspect.java
+15
-4
No files found.
order-application-service/src/main/java/cn/freemud/aop/WebAspect.java
View file @
c1c647ca
...
@@ -31,6 +31,7 @@ import java.beans.PropertyDescriptor;
...
@@ -31,6 +31,7 @@ import java.beans.PropertyDescriptor;
import
java.lang.reflect.Method
;
import
java.lang.reflect.Method
;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Objects
;
/**
/**
* All rights Reserved, Designed By www.freemud.cn
* All rights Reserved, Designed By www.freemud.cn
...
@@ -70,6 +71,8 @@ public class WebAspect {
...
@@ -70,6 +71,8 @@ public class WebAspect {
private
static
final
String
SESSION_ID_STR
=
"sessionId"
;
private
static
final
String
SESSION_ID_STR
=
"sessionId"
;
private
static
final
String
APP_CHANNEL
=
"3"
;
@Pointcut
(
"execution(* cn.freemud.controller..*.*(..))"
)
@Pointcut
(
"execution(* cn.freemud.controller..*.*(..))"
)
public
void
webAspect
()
{
public
void
webAspect
()
{
}
}
...
@@ -86,12 +89,20 @@ public class WebAspect {
...
@@ -86,12 +89,20 @@ public class WebAspect {
// 是否授权验证
// 是否授权验证
AssortmentCustomerInfoVo
userInfo
=
assortmentCustomerInfoManager
.
getCustomerInfoByObject
(
sessionId
);
AssortmentCustomerInfoVo
userInfo
=
assortmentCustomerInfoManager
.
getCustomerInfoByObject
(
sessionId
);
if
(!
notFilterUrls
.
contains
(
requestUrl
))
{
if
(!
notFilterUrls
.
contains
(
requestUrl
))
{
if
(
userInfo
==
null
||
StringUtils
.
isEmpty
(
userInfo
.
getMemberId
())
)
{
if
(
userInfo
==
null
)
{
throw
new
CommonServiceException
(
CommonResponseResult
.
USER_UNAUTHORIZED
);
throw
new
CommonServiceException
(
CommonResponseResult
.
USER_UNAUTHORIZED
);
}
}
List
<
String
>
unauthorizedUrls
=
Arrays
.
asList
(
getNotFilterUrl
(
CommonRedisKeyConstant
.
SAAS_NOT_AUTHORIZED_URL
,
NOT_AUTHORIZED_KEY
).
split
(
","
));
// app 没有unionId得概念, 并且app上是thirdMemberId概念。 不需要做校验
if
(!
unauthorizedUrls
.
contains
(
requestUrl
)
&&
StringUtils
.
isEmpty
(
userInfo
.
getUnionId
()))
{
if
(!
Objects
.
equals
(
userInfo
.
getChannel
(),
APP_CHANNEL
))
{
throw
new
CommonServiceException
(
CommonResponseResult
.
USER_UNAUTHORIZED
);
if
(
StringUtils
.
isEmpty
(
userInfo
.
getMemberId
()))
{
throw
new
CommonServiceException
(
CommonResponseResult
.
USER_UNAUTHORIZED
);
}
List
<
String
>
unauthorizedUrls
=
Arrays
.
asList
(
getNotFilterUrl
(
CommonRedisKeyConstant
.
SAAS_NOT_AUTHORIZED_URL
,
NOT_AUTHORIZED_KEY
).
split
(
","
));
if
(!
unauthorizedUrls
.
contains
(
requestUrl
)
&&
StringUtils
.
isEmpty
(
userInfo
.
getUnionId
()))
{
throw
new
CommonServiceException
(
CommonResponseResult
.
USER_UNAUTHORIZED
);
}
}
else
{
// app上是thirdMemberId概念
}
}
}
}
Object
[]
args
=
joinPoint
.
getArgs
();
Object
[]
args
=
joinPoint
.
getArgs
();
...
...
shopping-cart-application-service/src/main/java/cn/freemud/aop/WebAspect.java
View file @
c1c647ca
...
@@ -31,6 +31,7 @@ import java.beans.PropertyDescriptor;
...
@@ -31,6 +31,7 @@ import java.beans.PropertyDescriptor;
import
java.lang.reflect.Method
;
import
java.lang.reflect.Method
;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Objects
;
/**
/**
* All rights Reserved, Designed By www.freemud.cn
* All rights Reserved, Designed By www.freemud.cn
...
@@ -70,6 +71,8 @@ public class WebAspect {
...
@@ -70,6 +71,8 @@ public class WebAspect {
private
static
final
String
SESSION_ID_STR
=
"sessionId"
;
private
static
final
String
SESSION_ID_STR
=
"sessionId"
;
private
static
final
String
APP_CHANNEL
=
"3"
;
@Pointcut
(
"execution(* cn.freemud.controller..*.*(..))"
)
@Pointcut
(
"execution(* cn.freemud.controller..*.*(..))"
)
public
void
webAspect
()
{
public
void
webAspect
()
{
}
}
...
@@ -86,12 +89,20 @@ public class WebAspect {
...
@@ -86,12 +89,20 @@ public class WebAspect {
// 是否授权验证
// 是否授权验证
AssortmentCustomerInfoVo
userInfo
=
assortmentCustomerInfoManager
.
getCustomerInfoByObject
(
sessionId
);
AssortmentCustomerInfoVo
userInfo
=
assortmentCustomerInfoManager
.
getCustomerInfoByObject
(
sessionId
);
if
(!
notFilterUrls
.
contains
(
requestUrl
))
{
if
(!
notFilterUrls
.
contains
(
requestUrl
))
{
if
(
userInfo
==
null
||
StringUtils
.
isEmpty
(
userInfo
.
getMemberId
())
)
{
if
(
userInfo
==
null
)
{
throw
new
CommonServiceException
(
CommonResponseResult
.
USER_UNAUTHORIZED
);
throw
new
CommonServiceException
(
CommonResponseResult
.
USER_UNAUTHORIZED
);
}
}
List
<
String
>
unauthorizedUrls
=
Arrays
.
asList
(
getNotFilterUrl
(
CommonRedisKeyConstant
.
SAAS_NOT_AUTHORIZED_URL
,
NOT_AUTHORIZED_KEY
).
split
(
","
));
// app 没有unionId得概念, 并且app上是thirdMemberId概念。 不需要做校验
if
(!
unauthorizedUrls
.
contains
(
requestUrl
)
&&
StringUtils
.
isEmpty
(
userInfo
.
getUnionId
()))
{
if
(!
Objects
.
equals
(
userInfo
.
getChannel
(),
APP_CHANNEL
))
{
throw
new
CommonServiceException
(
CommonResponseResult
.
USER_UNAUTHORIZED
);
if
(
StringUtils
.
isEmpty
(
userInfo
.
getMemberId
()))
{
throw
new
CommonServiceException
(
CommonResponseResult
.
USER_UNAUTHORIZED
);
}
List
<
String
>
unauthorizedUrls
=
Arrays
.
asList
(
getNotFilterUrl
(
CommonRedisKeyConstant
.
SAAS_NOT_AUTHORIZED_URL
,
NOT_AUTHORIZED_KEY
).
split
(
","
));
if
(!
unauthorizedUrls
.
contains
(
requestUrl
)
&&
StringUtils
.
isEmpty
(
userInfo
.
getUnionId
()))
{
throw
new
CommonServiceException
(
CommonResponseResult
.
USER_UNAUTHORIZED
);
}
}
else
{
// app上是thirdMemberId概念
}
}
}
}
Object
[]
args
=
joinPoint
.
getArgs
();
Object
[]
args
=
joinPoint
.
getArgs
();
...
...
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