Skip to content

Commit 28e6c2c

Browse files
authored
Merge pull request #381 from kbase/develop
Develop -> Master (Release 0.5.0)
2 parents 43f3f87 + abce92d commit 28e6c2c

File tree

103 files changed

+2496
-1744
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+2496
-1744
lines changed

Dockerfile

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
1+
FROM kbase/sdkbase2 as build
2+
3+
COPY . /tmp/auth2
4+
RUN cd /tmp \
5+
&& git clone https://github.com/kbase/jars \
6+
&& cd auth2 \
7+
&& ant buildwar
8+
19
FROM kbase/kb_jre:latest
210

311
# These ARGs values are passed in via the docker build command
412
ARG BUILD_DATE
513
ARG VCS_REF
614
ARG BRANCH=develop
715

8-
COPY deployment/ /kb/deployment/
9-
COPY jettybase/ /kb/deployment/jettybase/
16+
COPY --from=build /tmp/auth2/deployment/ /kb/deployment/
17+
COPY --from=build /tmp/auth2/jettybase/ /kb/deployment/jettybase/
1018

1119
# The BUILD_DATE value seem to bust the docker cache when the timestamp changes, move to
1220
# the end

RELEASE_NOTES.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
11
Authentication Service MKII release notes
22
=========================================
33

4+
0.5.0
5+
-----
6+
7+
* BACKWARDS INCOMPATIBILITY - any in flight login or link flows will fail after the server is
8+
upgraded to 0.5.0.
9+
* ADMIN ACTION REQUIRED - before starting the upgraded server, remove all data from the `tempdata`
10+
collection to avoid server errors for in flight login or link flows.
11+
* Added PKCE to the login and link OAuth2 flows for Google and Globus.
12+
* See https://www.oauth.com/oauth2-servers/pkce/ for details.
13+
* OrcID currently does not support PKCE, see https://github.com/ORCID/ORCID-Source/issues/5977
14+
* The OAuth2 state value is now stored in the database rather than in a cookie.
15+
416
0.4.3
517
-----
618

TODO.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ Auth2 TODO list
33

44
Auth service work
55
-----------------
6+
* When OrcID supports PKCE, implement: https://github.com/ORCID/ORCID-Source/issues/5977
67
* Include users's identities in admin user view
78
* Complete rich UI (code not in this repo)
89
* Currently only covers login, link, me, and tokens.

build.xml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -216,13 +216,6 @@
216216
</copy>
217217
</target>
218218

219-
<target name="docker_image" depends="buildwar" description="build the docker image">
220-
<!-- make the docker image that for auth2 -->
221-
<exec executable="./build/build_docker_image.sh">
222-
</exec>
223-
224-
</target>
225-
226219
<target name="javadoc" description="build javadocs">
227220
<javadoc access="protected"
228221
author="false"
@@ -336,6 +329,7 @@
336329
<test name="us.kbase.test.auth2.lib.LoginTokenTest"/>
337330
<test name="us.kbase.test.auth2.lib.LoginStateTest"/>
338331
<test name="us.kbase.test.auth2.lib.NameTest"/>
332+
<test name="us.kbase.test.auth2.lib.OAuth2StartDataTest"/>
339333
<test name="us.kbase.test.auth2.lib.PasswordHashAndSaltTest"/>
340334
<test name="us.kbase.test.auth2.lib.PasswordTest"/>
341335
<test name="us.kbase.test.auth2.lib.PolicyIDTest"/>

src/us/kbase/auth2/cryptutils/RandomDataGenerator.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@ public interface RandomDataGenerator {
1212
* @return a token.
1313
*/
1414
String getToken();
15+
16+
17+
/** Generate a random token encoded in Base32 in multiples of 40 bits / 8 characters.
18+
* @param sizeMultiple the size of the token in 40 bit / 8 character increments.
19+
* @return a token.
20+
*/
21+
String getToken(int sizeMultiple);
1522

1623
/** Generate a random password consisting of upper and lower case ascii letters excluding
1724
* lower case l and o and uppercase I and O, digits excluding one and zero, and the symbols

src/us/kbase/auth2/cryptutils/SHA1RandomDataGenerator.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,15 @@ public SHA1RandomDataGenerator() throws NoSuchAlgorithmException {
3434

3535
@Override
3636
public String getToken() {
37-
final byte[] b = new byte[20]; //160 bits so 32 b32 chars
37+
return getToken(4); //160 bits so 32 b32 chars
38+
}
39+
40+
@Override
41+
public String getToken(final int sizeMultiple) {
42+
if (sizeMultiple < 1) {
43+
throw new IllegalArgumentException("sizeMultiple must be > 0");
44+
}
45+
final byte[] b = new byte[sizeMultiple * 5]; // 40 bits / 8 b32 chars per sizeMultiple
3846
random.nextBytes(b);
3947
return new Base32().encodeAsString(b);
4048
}

src/us/kbase/auth2/kbase/KBaseAuthConfig.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,14 @@
99
import java.util.Collections;
1010
import java.util.HashSet;
1111
import java.util.Map;
12+
import java.util.Optional;
1213
import java.util.Set;
1314
import java.util.regex.Matcher;
1415
import java.util.regex.Pattern;
1516

1617
import org.ini4j.Ini;
1718
import org.slf4j.LoggerFactory;
1819

19-
import com.google.common.base.Optional;
20-
2120
import us.kbase.auth2.lib.identity.IdentityProviderConfig;
2221
import us.kbase.auth2.lib.identity.IdentityProviderConfig.Builder;
2322
import us.kbase.auth2.lib.identity.IdentityProviderConfig.IdentityProviderConfigurationException;
@@ -99,8 +98,8 @@ public KBaseAuthConfig(final Path filepath, final boolean nullLogger)
9998
templateDir = Paths.get(getString(KEY_TEMPLATE_DIR, cfg, true));
10099
mongoHost = getString(KEY_MONGO_HOST, cfg, true);
101100
mongoDB = getString(KEY_MONGO_DB, cfg, true);
102-
mongoUser = Optional.fromNullable(getString(KEY_MONGO_USER, cfg));
103-
Optional<String> mongop = Optional.fromNullable(getString(KEY_MONGO_PWD, cfg));
101+
mongoUser = Optional.ofNullable(getString(KEY_MONGO_USER, cfg));
102+
Optional<String> mongop = Optional.ofNullable(getString(KEY_MONGO_PWD, cfg));
104103
if (mongoUser.isPresent() ^ mongop.isPresent()) {
105104
mongop = null; //GC
106105
throw new AuthConfigurationException(String.format(
@@ -109,7 +108,7 @@ public KBaseAuthConfig(final Path filepath, final boolean nullLogger)
109108
KEY_MONGO_USER, KEY_MONGO_PWD, cfg.get(TEMP_KEY_CFG_FILE), CFG_LOC));
110109
}
111110
mongoPwd = mongop.isPresent() ?
112-
Optional.of(mongop.get().toCharArray()) : Optional.absent();
111+
Optional.of(mongop.get().toCharArray()) : Optional.empty();
113112
mongop = null; //GC
114113
cookieName = getString(KEY_COOKIE_NAME, cfg, true);
115114
environmentHeader = getEnvironmentHeader(cfg);

0 commit comments

Comments
 (0)