Adding custom context to interceptor method
See original GitHub issueWe are implementing a request signing mechanism for one of our customer banking apps and we use combination of OkHttp and Retrofit. The technical flow is supposed to go like this:
- A user enters a PIN code in UI
- Application constructs a request object (for example, a new payment)
- Request object is serialized to underlying raw HTTP body data (
byte[]
) - We sign the
byte[]
using our signing mechanism based on the PIN code value - We put a special HTTP header in request, with the signature value
We were looking for a way to obtain raw HTTP body data and add HTTP header based on data and PIN code value. The interceptors seemed like a nice way to go around the problem. However, we didn’t find any clean way to pass our signing mechanism context data to the filter - we only get request related information as a part of the “chain” object.
It would be nice to have some clean way to pass custom context to interceptor method…
Issue Analytics
- State:
- Created 7 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
54.2 Using Interceptors - The Java EE Tutorial
Add the interceptor binding type annotation to the target component's class, method, or constructor. Interceptor binding types are applied using the same rules ......
Read more >Add Bean and Interceptor to the context of an application from ...
I want to add a dependency of a jar on the application, add another bean and another interceptor to the context.In another project...
Read more >Injecting Custom Services into Your Object's Interception Chain
Custom context attributes can affect the context in which the object is activated and running in, as well as install all four types...
Read more >6.2. Implementing a simple custom Interceptor
An interceptor filters method calls performed on on the ... The easiest way to add a custom interceptor is to add a spring...
Read more >A Spring Handler Interceptor to Manage Sessions - Baeldung
Using a Custom Spring MVC's Handler Interceptor to Manage Sessions ... Spring Web so don't forget to add spring-core and spring-context for ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Does this work? https://publicobject.com/2016/01/17/sneaking-data-into-an-okhttp-interceptor/
No action for us to take on this.