Skip to content

Commit 2dde1a4

Browse files
authored
Hzy token multi client (#69) (#70)
* Fix bugs in email sending and vm power managing. * Token 先从 Header 获取,再从 cookie 获取
1 parent c96ef03 commit 2dde1a4

File tree

1 file changed

+4
-4
lines changed
  • cloudapi-web/src/main/kotlin/cn/edu/buaa/scs/auth

1 file changed

+4
-4
lines changed

cloudapi-web/src/main/kotlin/cn/edu/buaa/scs/auth/Token.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,16 +68,16 @@ fun fetchToken(call: ApplicationCall) {
6868
else -> {
6969
// TODO 后续兼容JWT校验
7070

71-
// 1. try to get token from cookies
72-
possibleTokenKey.firstNotNullOfOrNull { call.request.cookies[it] } ?:
73-
74-
// 2. try to get token from headers
71+
// 1. try to get token from headers
7572
possibleTokenKey.firstNotNullOfOrNull {
7673
call.request.headers[it]?.let { auth ->
7774
if (auth.startsWith("Bearer")) auth.split(" ")[1] else auth
7875
}
7976
} ?:
8077

78+
// 2. try to get token from cookies
79+
possibleTokenKey.firstNotNullOfOrNull { call.request.cookies[it] } ?:
80+
8181
// 3. try to get token from query parameters
8282
possibleTokenKey.firstNotNullOfOrNull { call.request.queryParameters[it] }
8383

0 commit comments

Comments
 (0)