Skip to content

Commit 176776d

Browse files
author
Roman Sutormin
authored
Merge pull request #27 from MrCreosote/develop
Optionally allow insecure auth urls
2 parents 381bf9d + 0935235 commit 176776d

File tree

4 files changed

+57
-9
lines changed

4 files changed

+57
-9
lines changed

.classpath

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="src" path="src"/>
4+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
5+
<classpathentry kind="lib" path="/jars/lib/jars/apache_commons/http/httpclient-4.3.1.jar"/>
6+
<classpathentry kind="lib" path="/jars/lib/jars/apache_commons/http/httpcore-4.3.jar"/>
7+
<classpathentry kind="lib" path="/jars/lib/jars/apache_commons/http/httpmime-4.3.1.jar"/>
8+
<classpathentry kind="lib" path="/jars/lib/jars/apache_commons/commons-io-2.4.jar"/>
9+
<classpathentry kind="lib" path="/jars/lib/jars/apache_commons/commons-lang3-3.1.jar"/>
10+
<classpathentry kind="lib" path="/jars/lib/jars/apache_commons/commons-logging-1.1.1.jar"/>
11+
<classpathentry kind="lib" path="/jars/lib/jars/apache_commons/velocity-1.7.jar"/>
12+
<classpathentry kind="lib" path="/jars/lib/jars/jackson/jackson-annotations-2.2.3.jar" sourcepath="/jars/lib/jars/jackson/jackson-annotations-2.2.3-sources.jar"/>
13+
<classpathentry kind="lib" path="/jars/lib/jars/jackson/jackson-core-2.2.3.jar" sourcepath="/jars/lib/jars/jackson/jackson-core-2.2.3-sources.jar"/>
14+
<classpathentry kind="lib" path="/jars/lib/jars/jackson/jackson-databind-2.2.3.jar" sourcepath="/jars/lib/jars/jackson/jackson-databind-2.2.3-sources.jar"/>
15+
<classpathentry kind="lib" path="/jars/lib/jars/junit/junit-4.9.jar"/>
16+
<classpathentry kind="lib" path="/jars/lib/jars/mongo/mongo-java-driver-2.11.2.jar"/>
17+
<classpathentry kind="lib" path="/jars/lib/jars/mongo/mongo-java-driver-2.13.3.jar"/>
18+
<classpathentry kind="lib" path="/jars/lib/jars/derby/derby-10.10.1.1.jar"/>
19+
<classpathentry kind="lib" path="/jars/lib/jars/easymock/easymock-3.2.jar"/>
20+
<classpathentry kind="lib" path="/jars/lib/jars/ini4j/ini4j-0.5.2.jar"/>
21+
<classpathentry kind="lib" path="/jars/lib/jars/jetty/jetty-all-7.0.0.jar"/>
22+
<classpathentry kind="lib" path="/jars/lib/jars/jna/jna-3.4.0.jar"/>
23+
<classpathentry kind="lib" path="/jars/lib/jars/servlet/servlet-api-2.5.jar"/>
24+
<classpathentry kind="lib" path="/jars/lib/jars/syslog4j/syslog4j-0.9.46.jar"/>
25+
<classpathentry kind="lib" path="/jars/lib/jars/javassist/javassist-3.18.2.jar"/>
26+
<classpathentry kind="lib" path="/jars/lib/jars/slf4j/slf4j-api-1.7.7.jar"/>
27+
<classpathentry kind="lib" path="/jars/lib/jars/texttable/text-table-formatter-1.1.1.jar"/>
28+
<classpathentry kind="lib" path="/jars/lib/jars/kbase/workspace/WorkspaceClient-0.2.0.jar"/>
29+
<classpathentry kind="lib" path="/jars/lib/jars/jfreechart/jcommon-1.0.21.jar"/>
30+
<classpathentry kind="lib" path="/jars/lib/jars/jfreechart/jfreechart-1.0.17.jar"/>
31+
<classpathentry kind="lib" path="/jars/lib/jars/logback/logback-classic-1.1.2.jar"/>
32+
<classpathentry kind="lib" path="/jars/lib/jars/logback/logback-core-1.1.2.jar"/>
33+
<classpathentry kind="lib" path="/jars/lib/jars/joda/joda-time-2.2.jar"/>
34+
<classpathentry kind="lib" path="/jars/lib/jars/kbase/auth/kbase-auth-0.4.2.jar"/>
35+
<classpathentry kind="output" path="bin"/>
36+
</classpath>

RELEASE_NOTES.txt

+8-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ OVERVIEW
44
-----------------------------------------
55
Repo for code shared between Java services.
66

7+
VERSION: 0.0.21 (Released 8/26/2016)
8+
--------------------------------------
9+
10+
NEW FEATURES:
11+
- The Java servers now accept an 'auth-service-url-allow-insecure' parameter in
12+
the deployment configuration file. Set to 'true' if using an http url rather
13+
than https for the auth service.
14+
715
VERSION: 0.0.20 (Released 8/5/2016)
816
--------------------------------------
917

@@ -14,12 +22,10 @@ UPDATED FEATURES / MAJOR BUG FIXES:
1422
- Java servers now instantiate an auth client once on startup rather than
1523
every call (if an auth url is provided in the config). This prevents an
1624
extra call to the auth service for every server call.
17-
1825

1926
ANTICIPATED FUTURE DEVELOPMENTS:
2027
- None
2128

22-
2329
VERSION: 0.0.19 (Released 8/3/2016)
2430
--------------------------------------
2531

build.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
<include name="jna/jna-3.4.0.jar"/>
4646
<include name="servlet/servlet-api-2.5.jar"/>
4747
<include name="syslog4j/syslog4j-0.9.46.jar"/>
48-
<include name="kbase/auth/kbase-auth-0.4.0.jar"/>
48+
<include name="kbase/auth/kbase-auth-0.4.2.jar"/>
4949
<include name="texttable/text-table-formatter-1.1.1.jar"/>
5050
<include name="apache_commons/http/httpclient-4.3.1.jar"/>
5151
<include name="apache_commons/http/httpcore-4.3.jar"/>

src/us/kbase/common/service/JsonServerServlet.java

+12-6
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,11 @@ public class JsonServerServlet extends HttpServlet {
7979
* the server name.
8080
*/
8181
public static final String KB_SERVNAME = "KB_SERVICE_NAME";
82-
private static final String CONFIG_AUTH_SERVICE_URL_PARAM = "auth-service-url";
82+
private static final String CONFIG_AUTH_SERVICE_URL_PARAM =
83+
"auth-service-url";
84+
//set to 'true' for true, anything else for false.
85+
private static final String CONFIG_AUTH_SERVICE_ALLOW_INSECURE_URL_PARAM =
86+
"auth-service-url-allow-insecure";
8387
private static final String KB_JOB_SERVICE_URL = "KB_JOB_SERVICE_URL";
8488
private static final String CONFIG_JOB_SERVICE_URL_PARAM = "job-service-url";
8589
private final ConfigurableAuthService auth;
@@ -174,12 +178,14 @@ public JsonServerServlet(String specServiceName) {
174178

175179
private ConfigurableAuthService getAuth(final Map<String, String> config) {
176180
final String authURL = config.get(CONFIG_AUTH_SERVICE_URL_PARAM);
177-
final AuthConfig c;
178-
if (authURL == null || authURL.isEmpty()) {
179-
c = new AuthConfig();
180-
} else {
181+
final AuthConfig c = new AuthConfig();
182+
if (authURL != null && !authURL.isEmpty()) {
183+
if (STRING_TRUE.equals(config.get(
184+
CONFIG_AUTH_SERVICE_ALLOW_INSECURE_URL_PARAM))) {
185+
c.withAllowInsecureURLs(true);
186+
}
181187
try {
182-
c = new AuthConfig().withKBaseAuthServerURL(new URL(authURL));
188+
c.withKBaseAuthServerURL(new URL(authURL));
183189
} catch (URISyntaxException | MalformedURLException e) {
184190
startupFailed();
185191
sysLogger.logErr(String.format(

0 commit comments

Comments
 (0)