Skip to content

Minor version bump for December 2017 #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Dec 14, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,10 @@
### V1.0-SNAPSHOT
+ Initial release with HMAC256 and RSA256 signing utility
### V1.0.1-SNAPSHOT
+ Enhancement for Issue #1 - ApiList sorting is not based on key first then value
+ Enhancement for Issue #1 - ApiList sorting is not based on key first then value
### V1.1.0-SNAPSHOT
+ Minor refactoring
+ Update interface name so as be intuitive
+ Update corresponding test cases
+ Include Issue/PR templates
+ Include Contribution template
11 changes: 11 additions & 0 deletions CONTRIBUTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
## Contributing:
We welcome your involvement, be it fixing bugs or implementing new features that you find relevant to this library.

To contribute, you may follow the steps below:
1. Fork the repo
2. Create a new branch from `development` to work on your contribution
3. Create a pull request back when you are done

Please refer to the ISSUES and PULL REQUEST templates when raising them.

You can raise an issue within this Github repository to kick-start the discussion first.
28 changes: 28 additions & 0 deletions ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Expected Behavior

Please describe the behavior you are expecting

# Current Behavior

What is the current behavior?

# Failure Information (for bugs)

Please help provide information about the failure if this is a bug. If it is not a bug, please remove the rest of this template and label it as **enhancement**

## Steps to Reproduce

Please provide detailed steps for reproducing the issue.

1. step 1
2. step 2
3. and so on...

## Context

Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.


## Failure Logs

Please include any relevant log snippets or files here.
19 changes: 19 additions & 0 deletions PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

Fixes # (issue number)

## Type of change

Please delete options that are not relevant.

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] This change requires a documentation update

# How Has This Been Tested?

Please describe or list the test cases that you ran to verify your changes, and provide instructions so we can reproduce.

45 changes: 21 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ mvn package
```

The compiled _jar_ file will be located in the **target** folder
+ java-apex-api-security-1.0-SNAPSHOT.jar
+ java-apex-api-security-1.0-SNAPSHOT-jar-with-dependencies.jar (this includes log4j libraries)
+ java-apex-api-security-<version>-SNAPSHOT.jar
+ java-apex-api-security-<version>-SNAPSHOT-jar-with-dependencies.jar (this includes log4j libraries)

Import this jar file into your java classpath to use the utility class

Expand Down Expand Up @@ -113,7 +113,7 @@ dependencies {

#### Development

##### Preparing BaseString :
##### Preparing Signature BaseString :

Method:
* getBaseString
Expand All @@ -137,7 +137,7 @@ formList.add("param1", "data1");
String baseString;

try {
baseString = ApiAuthorization.getBaseString(
baseString = ApiSigning.getBaseString(
"<<authPrefix>>",
"HMACSHA256",
"<<appId>>",
Expand All @@ -156,10 +156,10 @@ System.out.println(baseString);

```

##### Preparing L1 Security Signature :
##### Preparing HMACSHA256 L1 Security Signature :

Method:
* getL1Signature
* getHMACSignature

Params:
* baseString
Expand All @@ -171,7 +171,7 @@ String secret = "<<appSecret>>";
String L1Sig;

try {
L1Sig = ApiAuthorization.getL1Signature(baseString, secret);
L1Sig = ApiSigning.getHMACSignature(baseString, secret);
System.out.println(L1Sig);

} catch (ApiUtilException e) {
Expand All @@ -180,10 +180,10 @@ try {

```

##### Preparing L2 Security Signature :
##### Preparing RSA256 L2 Security Signature :

Method:
* getL2Signature
* getRSASignature

Params:
* baseString
Expand All @@ -198,22 +198,25 @@ String publicCertFileName = "certificates/ssc.alpha.example.com.cer";

try {

PrivateKey privateKey = ApiAuthorization.getPrivateKeyFromKeyStore(keyStoreFileName, password, alias);
PrivateKey privateKey = ApiSigning.getPrivateKeyFromKeyStore(keyStoreFileName, password, alias);

String signature = ApiAuthorization.getL2Signature(baseString, privateKey);
String signature = ApiSigning.getRSASignature(baseString, privateKey);

System.out.println(expectedSignature);
System.out.println(signature);

PublicKey publicKey = ApiAuthorization.getPublicKeyFromX509Certificate(publicCertFileName);
PublicKey publicKey = ApiSigning.getPublicKeyFromX509Certificate(publicCertFileName);

} catch (ApexUtilLibException e) {
e.printStackTrace();
}

```

##### Preparing Authorization Token :
##### Preparing HTTP Signature Token :

Append this signature token into the Authorization header of the HTTP request

Params:
* realm
* authPrefix - Authorization Header scheme prefix , i.e 'prefix_appId'
Expand Down Expand Up @@ -241,23 +244,17 @@ String nonce = null;
String timestamp = null;

try {
String signature = ApiAuthorization.getToken("http://api.test.io/l2", "<<authPrefix>>", "get", url, appId, null, null, password, alias, certFileName, nonce, timestamp);
String signature = ApiSigning.getSignatureToken("http://api.test.io/l2", "<<authPrefix>>", "get", url, appId, null, null, password, alias, certFileName, nonce, timestamp);
} catch (ApiUtilException e) {
e.printStackTrace();
}
```
### Release:
+ Checkout CHANGELOG.md for releases

### Contributing:
We welcome your involvement, be it fixing bugs or implementing new features that you find relevant to this library.

To contribute, you may follow the steps below:
1. Fork the repo
2. Create a new branch from `development` to work on your contribution
3. Create a pull request back when you are done
### Contributing
+ For more information about contributing PRs and issues, see [CONTRIBUTING.md](CONTRIBUTING.md).

Alternatively, you can raise an issue within this Github repository.
### Release
+ See [CHANGELOG.md](CHANGELOG.md).

### Reference:
+ [UTF-8 in Gradle](https://stackoverflow.com/questions/21267234/show-utf-8-text-properly-in-gradle)
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {
id 'com.github.kt3k.coveralls' version '2.6.3'
}

version '1.0.1-SNAPSHOT'
version '1.1.0-SNAPSHOT'

tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
Expand All @@ -29,7 +29,7 @@ jar {
}
}
manifest {
attributes 'Main-Class': 'ApiAuthorization'
attributes 'Main-Class': 'ApiSigning'
}
}

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.api.util</groupId>
<artifactId>ApiSecurity</artifactId>
<version>1.0.1-SNAPSHOT</version>
<version>1.1.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
Expand Down
Loading