All Projects → esiqveland → okhttp-awssigner

esiqveland / okhttp-awssigner

Licence: Apache-2.0 license
An OkHttp interceptor for signing requests with AWSv4 signatures

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to okhttp-awssigner

RetryRequestInterceptor-for-OkHttp
a interceptor for OkHttp which can save failed request in storage and will retry request until success or retry times over limit , or request live time over limit
Stars: ✭ 42 (+200%)
Mutual labels:  okhttp, interceptor
Chucker
🔎 An HTTP inspector for Android & OkHTTP (like Charles but on device)
Stars: ✭ 2,169 (+15392.86%)
Mutual labels:  okhttp, interceptor
Ok2curl
Convert OkHttp requests into curl logs.
Stars: ✭ 295 (+2007.14%)
Mutual labels:  okhttp, interceptor
Okhttp Json Mock
Mock your datas for Okhttp and Retrofit in json format in just a few moves
Stars: ✭ 231 (+1550%)
Mutual labels:  okhttp, interceptor
Logginginterceptor
An OkHttp interceptor which has pretty logger for request and response. +Mock support
Stars: ✭ 1,149 (+8107.14%)
Mutual labels:  okhttp, interceptor
OKHttpLogInterceptor
A Pretty OkHttp Logging Interceptor(一款简洁漂亮的OkHttp Logging拦截器)
Stars: ✭ 16 (+14.29%)
Mutual labels:  okhttp, interceptor
superagent-intercept
Add functions that will be called during end() e.g. for handling error conditions without having the same code all over the place.
Stars: ✭ 23 (+64.29%)
Mutual labels:  interceptor
Sig
The most powerful and customizable binary pattern scanner
Stars: ✭ 131 (+835.71%)
Mutual labels:  signature
Android-Model-View-Presenter
No description or website provided.
Stars: ✭ 26 (+85.71%)
Mutual labels:  okhttp
libdigidocpp
Libdigidocpp library offers creating, signing and verification of digitally signed documents, according to XAdES and XML-DSIG standards. Documentation http://open-eid.github.io/libdigidocpp
Stars: ✭ 80 (+471.43%)
Mutual labels:  signature
DigiDoc4-Client
DigiDoc4 Client is an application for digitally signing and encrypting documents; the software includes functionality to manage Estonian ID-card - change pin codes etc.
Stars: ✭ 91 (+550%)
Mutual labels:  signature
BothamNetworking
Networking Framework written in Swift.
Stars: ✭ 26 (+85.71%)
Mutual labels:  interceptor
egnature
Egnature is an email signature generator tool, which is an open source and free to use.
Stars: ✭ 26 (+85.71%)
Mutual labels:  signature
SnortRules
This is an open source Snort rules repository
Stars: ✭ 18 (+28.57%)
Mutual labels:  signature
okhttp-eventsource
Server-sent events (SSE) client implementation for Java, based on OkHttp: http://javadoc.io/doc/com.launchdarkly/okhttp-eventsource
Stars: ✭ 70 (+400%)
Mutual labels:  okhttp
okir
A helper class that implements both an Espresso IdlingResource and an OkHttp Interceptor
Stars: ✭ 27 (+92.86%)
Mutual labels:  okhttp
SunnyBeach
阳光沙滩APP
Stars: ✭ 60 (+328.57%)
Mutual labels:  okhttp
okhttp kit
dart版okhttp - https://github.com/square/okhttp
Stars: ✭ 16 (+14.29%)
Mutual labels:  okhttp
grpc-jwt-spring-boot-starter
Spring boot starter for gRPC framework with JWT authorization
Stars: ✭ 24 (+71.43%)
Mutual labels:  interceptor
OkHttp3Utils
OkHttp3.0网络工具类
Stars: ✭ 34 (+142.86%)
Mutual labels:  okhttp

OkHttp AWSv4 Signer interceptor

Maven Central Build Status Coverage Status

What is it?

An interceptor for OkHttpClient from Square to sign requests for AWS services that require signatures.

This project aims to follow the AWSv4 signature spec described here: https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html

Motivation

I could not find a signing interceptor that did not depend on the entire AWS SDK, so I made this one. My goal is to reduce the number of dependencies, so as to make it very easy to include in any Java project.

Usage

Interceptor should be included late in the interceptor chain, so that all headers (including Host) has been set by OkHttp, before signing is invoked.

<dependency>
    <groupId>com.github.esiqveland.okhttp3</groupId>
    <artifactId>aws-interceptor</artifactId>
    <version>0.9.2</version>
</dependency>
String accessKey = "AKIDEXAMPLE";
String secretKey = "wJalrXUtnFEMI/K7MDENG+bPxRfiCYEXAMPLEKEY";
String regionName = "us-east-1";
String serviceName = "iam";


AwsConfiguration cfg = new AwsConfiguration(
        accessKey,
        secretKey,
        regionName,
        serviceName
);


Interceptor awsInterceptor = new AwsSigningInterceptor(cfg);


OkHttpClient client = new OkHttpClient.Builder()
    // NetworkInterceptor is invoked after Host header is set by OkHttpClient, so use this
    .addNetworkInterceptor(awsInterceptor)
    .build();

TODO

  • remove commons-lang dependency
  • add more tests from the examples of signing requests
    • support duplicate header keys: get-header-key-duplicate
    • support canonical header value trim: get-header-value-trim
    • url with spaces: get-space
    • urls with redundant path: get-slash
    • multiline-header value: get-header-value-multiline
      • not supported by OkHttp, see test testMultiLineHeader
  • support temporary credentials from AWS Security Token Service? See folder post-sts-token for testdata.
  • provide some form of debug logging?

Credits

The official AWSv4 signature documentation.

Apache jclouds for query parameter parsing and sorting.

License

Copyright (c) 2017 Eivind Larsen

This library is licensed under the Apache License, Version 2.0.

See http://www.apache.org/licenses/LICENSE-2.0.html or the LICENSE file in this repository for the full license text.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].