Skip to content

Commit cdb826d

Browse files
committed
Split EdgeRcClientCredentialProvider from core
We have been asked by a customer to minimize the dependencies in the core signing algorithm module. It appears the INI file reader library we picked pulls in a few things, so we extracting that signer into a separate artifact.
1 parent edb3fc5 commit cdb826d

File tree

12 files changed

+78
-12
lines changed

12 files changed

+78
-12
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ libraries.
1717
This project contains a core implementation module and five bindings to specific HTTP client libraries.
1818

1919
* [edgegrid-signer-core](edgegrid-signer-core) is the core signing implementation and base classes used by the individual library implementations.
20+
* [edgerc-reader](edgerc-reader) is a configuration file reader that supports edgerc files. These files are basically INI files with certain sections and properties.
2021
* [edgegrid-signer-apache-http-client](edgegrid-signer-apache-http-client) is a binding for [Apache HTTP Client][2].
2122
* [edgegrid-signer-google-http-client](edgegrid-signer-google-http-client) is a binding for [Google HTTP Client Library for Java][3].
2223
* [edgegrid-signer-rest-assured](edgegrid-signer-rest-assured) is a binding for [REST-assured][4].

edgegrid-signer-core/README.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,4 @@ credential.
8282
The constructors for all the `AbstractEdgeGridRequestSigner` implementations
8383
create one of these transparently whenever they are passed a `ClientCredential`.
8484

85-
`EdgeRcClientCredentialProvider` is another implementation of
86-
`ClientCredentialProvider` that can read from the EdgeRc configuration files
87-
that are used in various other EdgeGrid signing library implementations. The
88-
`#pickSectionName()` method can be overridden by the user to select different
89-
sections from the configuration file based on the current request.
90-
9185
[1]: https://developer.akamai.com/introduction/Client_Auth.html

edgegrid-signer-core/pom.xml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,6 @@
2222
<groupId>commons-codec</groupId>
2323
<artifactId>commons-codec</artifactId>
2424
</dependency>
25-
<dependency>
26-
<groupId>org.apache.commons</groupId>
27-
<artifactId>commons-configuration2</artifactId>
28-
</dependency>
2925
<dependency>
3026
<groupId>org.apache.commons</groupId>
3127
<artifactId>commons-lang3</artifactId>

edgegrid-signer-core/src/main/java/com/akamai/edgegrid/signer/AbstractEdgeGridRequestSigner.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public final ClientCredentialProvider getClientCredentialProvider() {
7575
* replaces {@code request}'s host name with the one specified by the credential.
7676
*
7777
* @param request an HTTP request with data used to sign
78-
* @param request an HTTP request to update with signature
78+
* @param requestToUpdate an HTTP request to update with signature
7979
* @throws RequestSigningException if failed to sign a request
8080
* @throws NoMatchingCredentialException if acquiring a {@link ClientCredential} throws {@code
8181
* NoMatchingCredentialException} or returns {@code null}

edgegrid-signer-core/src/main/java/com/akamai/edgegrid/signer/ClientCredentialProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
* <p>
2828
* If you are looking for a basic implementation of this interface, see
2929
* {@link DefaultClientCredentialProvider}. If you would like to read your configuration from an
30-
* EdgeRc file, see {@link EdgeRcClientCredentialProvider}.
30+
* EdgeRc file, see {@code EdgeRcClientCredentialProvider}.
3131
* </p>
3232
*
3333
* @author mmeyer@akamai.com

edgerc-reader/README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# EdgeGrid Client for Java
2+
3+
Java implementation of Akamai {OPEN} EdgeGrid signing.
4+
5+
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.akamai.edgegrid/edgerc-reader/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.akamai.edgegrid/edgerc-reader)
6+
[![Javadoc](http://www.javadoc.io/badge/com.akamai.edgegrid/edgerc-reader.svg)](http://www.javadoc.io/doc/com.akamai.edgegrid/edgerc-reader)
7+
8+
## Description
9+
10+
This library implements [Akamai {OPEN} EdgeGrid Authentication][1] for Java.
11+
This particular module is a `ClientCredentialProvider` implementation which is capable of reading
12+
credentials from an EdgeRC file.
13+
14+
## Overview of EdgeRC Files
15+
16+
The format of an EdgeRC file is simply an INI file where each section corresponds to an OPEN
17+
credential. Each section MUST have the following properties:
18+
* access_token
19+
* client_secret
20+
* client_token
21+
* host
22+
23+
In addition to those 4 required properties, an additional property `max-body` may be present. If
24+
absent, the implied default is 131072. Many users have mysteriously inherited a `max-body` value of
25+
8192 in their EdgeRC files. That value is very unlikely to be correct. If you encounter signature
26+
mismatch errors with POST requests, try removing that value from the file before trying anything
27+
else.
28+
29+
## Using `EdgeRcClientCredentialProvider`
30+
31+
```java
32+
ClientCredential credential = EdgeRcClientCredentialProvider.fromEdgeRc("~/.edgerc", "good1").getClientCredential("section");
33+
```
34+
35+
[1]: https://developer.akamai.com/introduction/Client_Auth.html

edgerc-reader/pom.xml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<parent>
6+
<artifactId>edgegrid-signer-parent</artifactId>
7+
<groupId>com.akamai.edgegrid</groupId>
8+
<version>4.0.0-SNAPSHOT</version>
9+
</parent>
10+
<modelVersion>4.0.0</modelVersion>
11+
12+
<artifactId>edgerc-reader</artifactId>
13+
<name>EdgeRC ClientCredentialProvider Implementation</name>
14+
15+
<dependencies>
16+
<dependency>
17+
<groupId>com.akamai.edgegrid</groupId>
18+
<artifactId>edgegrid-signer-core</artifactId>
19+
<version>${project.version}</version>
20+
</dependency>
21+
<dependency>
22+
<groupId>org.apache.commons</groupId>
23+
<artifactId>commons-configuration2</artifactId>
24+
</dependency>
25+
<dependency>
26+
<groupId>org.apache.commons</groupId>
27+
<artifactId>commons-lang3</artifactId>
28+
</dependency>
29+
<dependency>
30+
<groupId>org.hamcrest</groupId>
31+
<artifactId>hamcrest-all</artifactId>
32+
</dependency>
33+
<dependency>
34+
<groupId>org.testng</groupId>
35+
<artifactId>testng</artifactId>
36+
</dependency>
37+
</dependencies>
38+
39+
</project>

0 commit comments

Comments
 (0)