Skip to content

Commit 5973da5

Browse files
committed
renewal for the migration to akamai
1 parent 6382642 commit 5973da5

File tree

18 files changed

+586
-730
lines changed

18 files changed

+586
-730
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ bin/
2020
# Others
2121
.DS_Store
2222
.vscode
23+
.idea
2324
.classpath
2425
.settings
2526
.project

LICENSE

Lines changed: 0 additions & 201 deletions
This file was deleted.

README.md

Lines changed: 42 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,49 @@
1-
# Akamai-EdgeAuth: Akamai Edge Authorization Token for Java
1+
# EdgeAuth-Token-Java: Akamai Edge Authorization Token for Java
22

3-
[![Maven Central](https://img.shields.io/badge/maven%20central-0.1.0-brightgreen.svg)](http://search.maven.org/#artifactdetails%7Cio.github.astinchoi%7CAkamai-EdgeAuth-Java%7C0.1.0%7C)
4-
[![Build Status](https://travis-ci.org/AstinCHOI/Akamai-EdgeAuth-Java.svg?branch=master)](https://travis-ci.org/AstinCHOI/Akamai-EdgeAuth-Java)
5-
[![License](http://img.shields.io/:license-apache-blue.svg)](https://github.com/AstinCHOI/Akamai-EdgeAuth-Java/blob/master/LICENSE)
3+
[![Maven Central](https://img.shields.io/badge/maven%20central-0.1.0-brightgreen.svg)](http://search.maven.org/#artifactdetails%7Ccom.akamai%7Cedgeauth%7C0.1.0%7C)
4+
[![Build Status](https://travis-ci.org/akamai/EdgeAuth-Token-Java.svg?branch=master)](https://travis-ci.org/akamai/EdgeAuth-Token-Java)
5+
[![License](http://img.shields.io/:license-apache-blue.svg)](https://github.com/akamai/EdgeAuth-Token-Java/blob/master/LICENSE)
66

7-
Akamai-EdgeAuth is Akamai Edge Authorization Token in the HTTP Cookie, Query String and Header for a client.
7+
EdgeAuth-Token-Java is Akamai Edge Authorization Token in the HTTP Cookie, Query String and Header for a client.
88
You can configure it in the Property Manager at https://control.akamai.com.
99
It's a behavior which is Auth Token 2.0 Verification.
1010

11-
Akamai-EdgeAuth supports Java 1.6+. (This is Akamai unofficial code)
11+
EdgeAuth-Token-Java supports Java 1.6+.
1212

1313
<div style="text-align:center"><img src=https://github.com/AstinCHOI/akamai-asset/blob/master/edgeauth/edgeauth.png?raw=true /></div>
1414

1515

1616
## Build
17-
[Click Here](http://search.maven.org/#artifactdetails%7Cio.github.astinchoi%7CAkamai-EdgeAuth-Java%7C0.2.7%7C)
17+
[Click Here](http://search.maven.org/#artifactdetails%7Ccom.akamai%7Cedgeauth%7C0.1.0%7C)
1818

1919

2020
## Example
2121
```java
22-
import io.github.astinchoi.edgeauth.EdgeAuth;
23-
import io.github.astinchoi.edgeauth.EdgeAuthBuilder;
24-
import io.github.astinchoi.edgeauth.EdgeAuthException;
22+
import com.akamai.edgeauth.EdgeAuth;
23+
import com.akamai.edgeauth.EdgeAuthBuilder;
24+
import com.akamai.edgeauth.EdgeAuthException;
2525

2626

2727
public class EdgeAuthExample {
2828
public static void main(String[] args) {
2929
String hostname = "YourAkamaizedHostname";
30-
String encrpytionKey = "YourEncryptionKey";
30+
String ET_ENCRYPTION_KEY = "YourEncryptionKey";
3131
long duration = 500L; // 500 seconds
3232

33-
// => Option Code
33+
// Below examples here ..
3434
}
3535
}
3636
```
3737

38+
* ET_ENCRYPTION_KEY must be hexadecimal digit string with even-length.
39+
* Don't expose ET_ENCRYPTION_KEY on the public repository.
40+
41+
3842
#### URL parameter option
3943
```java
4044
try {
4145
EdgeAuth ea = new EdgeAuthBuilder()
42-
.key(encrpytionKey)
46+
.key(ET_ENCRYPTION_KEY)
4347
.windowSeconds(duration)
4448
.escapeEarly(true)
4549
.build();
@@ -65,17 +69,13 @@ try {
6569
e.printStackTrace();
6670
}
6771
```
68-
```java
69-
// In the URL option,
70-
// It depends on turning on/off 'Escape token input' in the property manager.
71-
// on: escapeEarly(true) / off: escapeEarly(false)
7272

73-
// In the [2) Query String],
74-
// it's only okay for 'Ignore query string' option on
73+
* 'Escape token input' option in the Property Manager corresponds to 'escape_early' in the code.
74+
| Escape token input (on) == escape_early (True)
75+
| Escape token input (off) == escape_early (False)
76+
* In [Example 2] for Query String, it's only okay for 'Ignore query string' option (on).
77+
* If you want to 'Ignore query string' option (off) using query string as your token, Please contact your Akamai representative.
7578

76-
// If you want to 'Ignore query string' off using query string as your token,
77-
// Please contact your Akamai representative.
78-
```
7979

8080
#### ACL(Access Control List) parameter option
8181
```java
@@ -98,19 +98,18 @@ try {
9898
4) Cookie Delimited by '!'
9999
**************************/
100100
String acl2[] = { "/akamai/edgeauth", "/akamai/edgeauth/list/*" };
101-
String token = ea.generateACLToken(EdgeAuth.join(EdgeAuth.ACL_DELIMITER, acl2));
101+
String token = ea.generateACLToken(acl2);
102102
String url = String.format("http(s)://%s%s", hostname, "/akamai/edgeauth/list/something2");
103103
String cookie = String.format("%s=%s", ea.getTokenName(), token);
104104
// => Link or Request "url" /w "cookie"
105105
} catch (EdgeAuthException e) {
106106
e.printStackTrace();
107107
}
108108
```
109-
```java
110-
// In the ACL option,
111-
// It doesn't matter turning on/off 'Escape token input' in the property manager
112-
// but you should keep escapeEarly(false) as default
113-
```
109+
110+
* ACL can use the wildcard(\*, ?) in the path.
111+
* Don't use '!' in your path because it's ACL Delimiter.
112+
* Use 'escape_early=False' as default setting but it doesn't matter turning on/off 'Escape token input' option in the Property Manager
114113

115114

116115
## Usage
@@ -130,28 +129,38 @@ try {
130129
| endTime | When does this token expire? 'endTime' overrides 'windowSeconds' |
131130
| windowSeconds | How long is this token valid for? |
132131
| fieldDelimiter | Character used to delimit token body fields. [ Default: ~ ] |
132+
| aclDelimiter | Character used to delimit acl. [ Default: ! ] |
133133
| escapeEarly | Causes strings to be 'url' encoded before being used. |
134134
| verbose | Print all parameters. |
135135

136136
#### EdgeAuth Static Variable
137137
```java
138-
public static final Long NOW = 0L; // When using startTime
139-
public static String ACL_DELIMITER = "!"; // When using ACL
138+
public static final Long NOW = 0L; // When using startTime, 0L means "from NOW".
140139
```
141140

142141

143142
#### EdgeAuth's Method
144143
| Method | Description |
145144
|--------|-------------|
146145
| generateURLToken(String url) | Single URL path. |
147-
| generateACLToken(String acl) | Access control list delimited by ! [ ie. /\* ] |
146+
| generateACLToken(String acl) | Single URL path - can use the wildcard (*, ?) |
147+
| generateACLToken(String[] acl) | Multi URL paths - can use the wildcard |
148148

149149
Returns the authorization token string.
150150

151151

152-
## License
152+
## Test
153+
"src/test" directory is only for the internal test.
154+
155+
156+
## Others
157+
If you use the **Segmented Media Protection** behavior in AMD(Adaptive Media Delivery) Product, **tokenName(options.tokenName)** should be '**hdnts**'.
153158

154-
Copyright 2017 Akamai Technologies, Inc. All rights reserved.
159+
<div style="text-align:center"><img src=https://github.com/AstinCHOI/akamai-asset/blob/master/edgeauth/segmented_media_protection.png?raw=true/></div>
160+
161+
162+
## License
163+
Copyright 2018 Akamai Technologies, Inc. All rights reserved.
155164

156165
Licensed under the Apache License, Version 2.0 (the "License");
157166
you may not use this file except in compliance with the License.

build.gradle

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
1-
apply plugin:'java'
1+
plugins {
2+
id 'java'
3+
}
4+
5+
group 'com.akamai'
6+
version '0.3.0'
27

3-
repositories {
4-
jcenter()
8+
sourceCompatibility = 1.8
9+
10+
repositories {
11+
mavenCentral()
512
}
613

7-
dependencies {
8-
testCompile 'junit:junit:4.12'
9-
}
14+
dependencies {
15+
testCompile group: 'junit', name: 'junit', version: '4.12'
16+
}

0 commit comments

Comments
 (0)