Guest User

Untitled

a guest
Jan 22nd, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. /**
  2. * Intercept the given request chain to add the Approov token to an 'Approov-Token' header.
  3. *
  4. * @param chain the request chain to modify
  5. * @return the modified response, authenticated by Approov
  6. */
  7. override fun intercept(chain: Interceptor.Chain): Response {
  8.  
  9. val originalRequest = chain.request()
  10. val approovToken = ApproovAttestation.shared().fetchApproovTokenAndWait(originalRequest.url().toString()).token
  11. val approovRequest = originalRequest.newBuilder().addHeader("Approov-Token", approovToken).build()
  12. return chain.proceed(approovRequest)
  13. }
Add Comment
Please, Sign In to add comment