Coder Social home page Coder Social logo

awsinterceptor's People

Contributors

ghedeon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

awsinterceptor's Issues

awsDummyRequest and concurrency

Hi, coming from stackoverflow I gave a look at your implementation.

Your awsDummyRequest in your interceptor assume only 1 call to the interceptor is performed at the same time. This is wrong assumption.

If multiple Http calls are perfomed in parallel they all work on the same instance of Request (the awsDummyRequest).

You should either create a new request every time or build a pool of reusable request, you create a new one if the others are busy and put the used one in the pool to reuse the objects.

Android Support Repository Dependancy

More of a question but when I try to add the example gradle snippet to my build.gradle file it errors with:

Error:Could not find com.android.support:support-annotations:25.3.0.
Required by:
    my-project:0.0.1
    my-project:0.0.1 > com.ghedeon:aws-interceptor:0.3

Please install the Android Support Repository from the Android SDK Manager.

I don't use the Android SDK as I'm developing a Java application and I can't import this due to project constraints. Is there no way round this?

Unable to reset stream after calculating AWS4 signature

Occurs for POST method, GET methods are working fine though.
@POST("getfixtures") fun getFixtures(@Body fixturesRequestPOJO: FixturesRequestPOJO): Call<List<FixturePOJO>>

FATAL EXCEPTION: OkHttp Dispatcher Process: net.test.app, PID: 22550 com.amazonaws.AmazonClientException: Unable to reset stream after calculating AWS4 signature at com.amazonaws.auth.AWS4Signer.calculateContentHash(AWS4Signer.java:360) at com.amazonaws.auth.AWS4Signer.sign(AWS4Signer.java:113) at com.ghedeon.AwsInterceptor.sign(AwsInterceptor.java:72) at com.ghedeon.AwsInterceptor.intercept(AwsInterceptor.java:53) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67) at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:185) at okhttp3.RealCall$AsyncCall.execute(RealCall.java:135) at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) at java.lang.Thread.run(Thread.java:818) Caused by: java.io.IOException: Mark has been invalidated. at java.io.BufferedInputStream.reset(BufferedInputStream.java:336) at com.amazonaws.auth.AWS4Signer.calculateContentHash(AWS4Signer.java:358) at com.amazonaws.auth.AWS4Signer.sign(AWS4Signer.java:113)  at com.ghedeon.AwsInterceptor.sign(AwsInterceptor.java:72)  at com.ghedeon.AwsInterceptor.intercept(AwsInterceptor.java:53)  at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)  at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)  at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:185)  at okhttp3.RealCall$AsyncCall.execute(RealCall.java:135)  at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)  at java.lang.Thread.run(Thread.java:818) 

Explaination required.

Please explain variables:

    String authUrl = ""; //AUTH URL
    String userName = ""; //USERNAME
    String password = ""; //PASSWORD

What is authURI and which username and password we have to give in here.

Issue in downloading audio/wav files?

I am downloading audio/wav file using AWS APIGateway with authorization but the file downloaded is corrupted and does not downloads more then 660B.

AWS IoT

Just curious if I can use this library to do HTTP post requests to AWS IoT. How can we modify this to actually do MQTT publish over websockets using Dagger/Retrofit?

Interceptor adds a Slash "/" after the endpoint

Url:
https://www.aws.com/api

Once the request is signed using the interceptor -

Excepted:
https://www.aws.com/api

Current:
https://www.aws.com/api/

Solution:

private fun Request.sign(): Request {
    val canonicalUrl = url.canonicalized()
    val awsDummyRequest = DefaultRequest<Any>(serviceName).apply {

        ****endpoint = url.host
        resourcePath = url.resource****  //separate out the host and resource

        httpMethod = HttpMethodName.valueOf(method)
        setQueryParams(canonicalUrl)
        setBody(body)
    }
    signer.sign(awsDummyRequest, credentialsProvider.credentials)
    return newBuilder()
        .url(canonicalUrl)
        .applyAwsHeaders(awsDummyRequest.headers)
        .build()}

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.