-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
xieyy
committed
Jan 22, 2025
1 parent
365e24b
commit c6ba9d3
Showing
5 changed files
with
59 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
...component/src/main/java/com/xyoye/common_component/network/helper/SignatureInterceptor.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.xyoye.common_component.network.helper | ||
|
||
import com.xyoye.common_component.base.app.BaseApplication | ||
import com.xyoye.common_component.utils.SecurityHelper | ||
import okhttp3.Interceptor | ||
import okhttp3.Response | ||
|
||
|
||
/** | ||
* author: [email protected] | ||
* time : 2025/1/21 | ||
* desc : 签名验证拦截器 | ||
*/ | ||
class SignatureInterceptor : Interceptor { | ||
|
||
override fun intercept(chain: Interceptor.Chain): Response { | ||
val oldRequest = chain.request() | ||
val newRequest = oldRequest.newBuilder() | ||
|
||
SecurityHelper.getInstance().getSignatureMap( | ||
oldRequest.url.encodedPath, | ||
BaseApplication.getAppContext() | ||
).forEach { | ||
newRequest.addHeader(it.key, it.value ?: "") | ||
} | ||
|
||
return chain.proceed(newRequest.build()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters