Skip to content

Commit 7e43944

Browse files
authored
Merge pull request #15 from kbase/dev-new_client
Publish with jitpack.io
2 parents cb21f9c + c6a731f commit 7e43944

File tree

7 files changed

+84
-11
lines changed

7 files changed

+84
-11
lines changed

README.md

Lines changed: 53 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,64 @@
11
# Auth2 client for Java
22

33
This repo contains a minimal client for the [KBase Auth2 server](https://github.com/kbase/auth2),
4-
covering only the most common operations - e.g. validating tokens and user names.
4+
covering only the most common operations - e.g. validating tokens and user names. For those
5+
functions, it is backwards compatible with the prior version of the client.
56

67
Most other uses are easily done with any http/REST client like the built in Java client
78
in 11+ or the Jersey client.
89

10+
## Including the client in your build
911

10-
## Prior version
12+
See https://jitpack.io/#kbase/auth2_client_java for instructions on how to include JitPack
13+
built dependencies in your build.
14+
15+
## JavaDoc
16+
17+
JavaDoc is available at
18+
```
19+
https://javadoc.jitpack.io/com/github/kbase/auth2_client_java/<version>/javadoc/
20+
```
21+
22+
For example:
23+
24+
https://javadoc.jitpack.io/com/github/kbase/auth2_client_java/0.5.0/javadoc/
25+
26+
## Usage
27+
28+
If backwards compatibility with versions of the client prior to 0.5.0 is required, use the
29+
`us.kbase.auth.ConfigurableAuthService` class. Otherwise use the
30+
`us.kbase.auth.client.AuthClient` class.
1131

12-
The prior version of the client is available at https://github.com/kbase/auth.
32+
Usage is fairly simple given a basic understanding of the auth2 server API - consult the
33+
JavaDocs for details.
1334

35+
## Development
36+
37+
### Adding and releasing code
38+
39+
* Adding code
40+
* All code additions and updates must be made as pull requests directed at the develop branch.
41+
* All tests must pass and all new code must be covered by tests.
42+
* All new code must be documented appropriately
43+
* Javadoc
44+
* General documentation if appropriate
45+
* Release notes
46+
* Releases
47+
* The main branch is the stable branch. Releases are made from the develop branch to the main
48+
branch.
49+
* Tag the version in git and github.
50+
* Create a github release.
51+
* Check that the javadoc is appropriately built on JitPack.
52+
53+
### Testing
54+
55+
Copy `test.cfg.example` to `test.cfg` and fill it in appropriately. Then:
56+
57+
```
58+
./gradlew test
59+
```
60+
61+
## Prior version
1462

63+
The prior version of the client is available at https://github.com/kbase/auth for source code
64+
and in https://github.com/kbase/jars for built jars.

RELEASE_NOTES.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# 0.5.0
2+
3+
* Complete rewrite of the auth client
4+
* Includes a backwards compatibility shim `ConfigurableAuthService`, that supports the the
5+
most widely used operations

TODO.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,7 @@
11
* Use a standard library for the string and token caches. The were copied from the original
2-
auth repo since they're known to work. Caffeine is nice
2+
auth repo since they're known to work. Caffeine is nice
3+
* Once updated to Java 11+, use the built in http client vs. urlconnection
4+
* Start up a local auth server in test mode for tests, stop using GHA tokens
5+
* Means fork PRs can pass tests
6+
* Wait until the shadow jar is published on maven somewhere so we don't have to pollute the
7+
build with the jars repo

build.gradle

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,10 @@
55
plugins {
66
id 'java'
77
id 'jacoco'
8+
id 'maven-publish'
89
}
910

10-
// TODO NOW jar build
11-
// TODO NOW javadoc build
12-
// TODO NOW publish javadocs on release
13-
// TODO NOW publish jar on release
11+
group = 'com.github.kbase'
1412

1513
repositories {
1614
mavenCentral()
@@ -22,6 +20,11 @@ compileJava {
2220
java.targetCompatibility = JavaVersion.VERSION_1_8
2321
}
2422

23+
java {
24+
withSourcesJar()
25+
withJavadocJar()
26+
}
27+
2528
test {
2629
systemProperty "test.cfg", "./test.cfg"
2730
testLogging {
@@ -45,6 +48,14 @@ javadoc {
4548
}
4649
}
4750

51+
publishing {
52+
publications {
53+
maven(MavenPublication) {
54+
from components.java
55+
}
56+
}
57+
}
58+
4859
dependencies {
4960

5061
// using older dependencies to not force upgrades on services that might not be able to

src/main/java/us/kbase/auth/client/AuthClient.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ public class AuthClient {
4848
/** Create the client.
4949
* @param auth2RootURI the root URI of the auth service - for example,
5050
* https://appdev.kbase.us/services/auth
51+
* @return the client.
5152
* @throws IOException if an IOException occurs communicating with the auth service.
5253
* @throws AuthException if an auth exception occurs communicating with the auth service.
5354
*/

src/main/java/us/kbase/auth/client/cache/StringCache.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public class StringCache {
3838

3939
/**
4040
* Create a new StringCache.
41-
* @param size the nominal size of the cache in strings, which must be < maxsize
41+
* @param size the nominal size of the cache in strings, which must be &lt; maxsize
4242
* @param maxsize the maximum size of the cache in strings
4343
*/
4444
public StringCache(int size, int maxsize) {
@@ -55,7 +55,7 @@ public StringCache(int size, int maxsize) {
5555

5656
/**
5757
* Set the lifetime of a string in the cache.
58-
* @param seconds the lifetime of a string
58+
* @param seconds the lifetime of a string.
5959
*/
6060
public void setExpiry(final long seconds) {
6161
if (seconds < 1) {
@@ -66,6 +66,7 @@ public void setExpiry(final long seconds) {
6666

6767
/**
6868
* Get the lifetime of a string in the cache.
69+
* @return the lifetime of a string.
6970
*/
7071
public long getExpiry() {
7172
return expiry;

src/main/java/us/kbase/auth/client/cache/TokenCache.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public class TokenCache {
4545

4646
/**
4747
* Create a new TokenCache.
48-
* @param size the nominal size of the cache in tokens, which must be < maxsize
48+
* @param size the nominal size of the cache in tokens, which must be &lt; maxsize
4949
* @param maxsize the maximum size of the cache in tokens
5050
*/
5151
public TokenCache(int size, int maxsize) {

0 commit comments

Comments
 (0)