question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Adding custom context to interceptor method

See original GitHub issue

We 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:closed
  • Created 7 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
swankjessecommented, Jan 29, 2017

No action for us to take on this.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found