GithubHelp home page GithubHelp logo

Comments (6)

gokulchandra avatar gokulchandra commented on May 26, 2024 1

Thanks for explaining that @rybalkinsd, let me dig deeper and take a stab at it. I will keep you posted.

from kohttp.

rybalkinsd avatar rybalkinsd commented on May 26, 2024

Need to figure out use cases

Possible API:

sign { params: Map<String, Any?> ->
    ...
}

from kohttp.

gokulchandra avatar gokulchandra commented on May 26, 2024

@rybalkinsd Can you provide more details this?

What I can understand is that we need a way to access the values set in the param block from within it?

param {
	"a" to ""
	"b" to "b"
	"sign" to sign(params) // params should refer to the previous set values of param
}

from kohttp.

rybalkinsd avatar rybalkinsd commented on May 26, 2024

@gokulchandra
Here is a doc describing sign technique for AWS.

In general, there are at least two ways to solve the problem:

  1. Add an interceptor that always adds a signature to a specific client requests.
    see okhttp3.internal.http.BridgeInterceptor
defaultHttpClient.fork {
    interceptors = ...
}

In my mind this interceptor can have just two params: signParameterName and signAlgorithm

  1. Add a DSL method like sign(consumer: (Map<String, Any?>) -> Unit): Unit,
    however sign looks like a bad naming in this case, because method could be used for other purposes.

Note: for sign algorithms param order matters (like md5). So we need to move to the ordered data structure. LinkedHashMap for example

from kohttp.

rybalkinsd avatar rybalkinsd commented on May 26, 2024

@SeanCai Could u pls provide an example of your sign function?

from kohttp.

rybalkinsd avatar rybalkinsd commented on May 26, 2024

has a potential relation with #64 (also interceptor)

from kohttp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.