Check builder result to either be a token or a user

Currently, a `user` property is always required (it not having content is also fine).

This adds support for only having the `oauth` key in the property file/environment.
This commit is contained in:
Ruben Dijkstra
2015-10-09 12:31:08 +02:00
parent 6516b20e16
commit 75b9184a00

View File

@@ -51,7 +51,7 @@ public class GitHubBuilder {
try {
builder = fromPropertyFile();
if (builder.user != null)
if (builder.oauthToken != null || builder.user != null)
return builder;
} catch (FileNotFoundException e) {
// fall through
@@ -60,7 +60,7 @@ public class GitHubBuilder {
builder = fromEnvironment();
if (builder.user != null)
if (builder.oauthToken != null || builder.user != null)
return builder;
else
throw (IOException)new IOException("Failed to resolve credentials from ~/.github or the environment.").initCause(cause);