StringBuilder url = new StringBuilder(genericEntryPoint);
try {
url.append("?").append(ACTION_PARAM_NAME).append("=").append(ACTION_AUTH);
url.append("&username=").append(URLEncoder.encode(userName, "UTF-8"));
} catch (UnsupportedEncodingException ex) {
throw new ManifoldCFException("getAuthorizationResponseUncached error: " + ex.getMessage(), ex);
}
try {
FetchTokensThread t = new FetchTokensThread(client, url.toString());
t.start();
t.join();
if (t.getException() != null) {
return unreachableResponse;
}
Auth auth = t.getAuthResponse();
if (auth == null) {
return userNotFoundResponse;
}
if (!auth.exists) {
return userNotFoundResponse;
}
if (auth.tokens == null) {
return new AuthorizationResponse(new String[]{}, AuthorizationResponse.RESPONSE_OK);
}
String[] tokens = new String[auth.tokens.size()];
int k = 0;
while (k < tokens.length) {
tokens[k] = (String) auth.tokens.get(k);
k++;
}
return new AuthorizationResponse(tokens, AuthorizationResponse.RESPONSE_OK);
} catch (InterruptedException ex) {
throw new ManifoldCFException(ex.getMessage(), ex, ManifoldCFException.INTERRUPTED);
}
}