com.github.esiqveland.okhttp3:aws-interceptor

OkHttp AWSv4 signing interceptor

Лицензия

Лицензия

Категории

Категории

AWS Контейнер PaaS Providers
Группа

Группа

com.github.esiqveland.okhttp3
Идентификатор

Идентификатор

aws-interceptor
Последняя версия

Последняя версия

0.9.2
Дата

Дата

Тип

Тип

jar
Описание

Описание

com.github.esiqveland.okhttp3:aws-interceptor
OkHttp AWSv4 signing interceptor
Ссылка на сайт

Ссылка на сайт

https://github.com/esiqveland/okhttp-awssigner
Система контроля версий

Система контроля версий

https://github.com/esiqveland/okhttp-awssigner

Скачать aws-interceptor

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/com.github.esiqveland.okhttp3/aws-interceptor/ -->
<dependency>
    <groupId>com.github.esiqveland.okhttp3</groupId>
    <artifactId>aws-interceptor</artifactId>
    <version>0.9.2</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.esiqveland.okhttp3/aws-interceptor/
implementation 'com.github.esiqveland.okhttp3:aws-interceptor:0.9.2'
// https://jarcasting.com/artifacts/com.github.esiqveland.okhttp3/aws-interceptor/
implementation ("com.github.esiqveland.okhttp3:aws-interceptor:0.9.2")
'com.github.esiqveland.okhttp3:aws-interceptor:jar:0.9.2'
<dependency org="com.github.esiqveland.okhttp3" name="aws-interceptor" rev="0.9.2">
  <artifact name="aws-interceptor" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.esiqveland.okhttp3', module='aws-interceptor', version='0.9.2')
)
libraryDependencies += "com.github.esiqveland.okhttp3" % "aws-interceptor" % "0.9.2"
[com.github.esiqveland.okhttp3/aws-interceptor "0.9.2"]

Зависимости

compile (3)

Идентификатор библиотеки Тип Версия
com.google.guava : guava jar 22.0
com.google.code.findbugs : jsr305 jar 3.0.2
io.vavr : vavr jar 0.9.0

provided (2)

Идентификатор библиотеки Тип Версия
org.slf4j : slf4j-api jar 1.7.25
com.squareup.okhttp3 : okhttp jar 3.8.1

test (9)

Идентификатор библиотеки Тип Версия
com.squareup.okhttp3 : logging-interceptor jar 3.8.1
com.squareup.okhttp3 : mockwebserver jar 3.8.1
org.assertj : assertj-core jar 3.8.0
org.mockito : mockito-all jar 1.10.19
org.junit.jupiter : junit-jupiter-engine jar 5.0.0-RC3
org.junit.platform : junit-platform-runner jar 1.0.0-RC3
org.junit.jupiter : junit-jupiter-api jar 5.0.0-RC3
org.junit.platform : junit-platform-launcher jar 1.0.0-RC3
org.junit.vintage : junit-vintage-engine jar 4.12.0-RC3

Модули Проекта

Данный проект не имеет модулей.

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.

Версии библиотеки

Версия
0.9.2
0.9.1
0.9.0