use of edu.uiuc.ncsa.security.core.exceptions.RetryException in project OA4MP by ncsa.
the class RegistrationServlet method addNewClient.
@Override
protected Client addNewClient(HttpServletRequest request, HttpServletResponse response) throws Throwable {
Client client = super.addNewClient(request, response);
client.setSecret(getRequiredParam(request, CLIENT_PUBLIC_KEY, client));
String x = getRequiredParam(request, CLIENT_ERROR_URL, client);
if (!x.toLowerCase().startsWith("https")) {
throw new RetryException("The error uri \"" + x + "\" is not secure.");
}
client.setErrorUri(x);
try {
debug("decoding public key from PEM");
KeyUtil.fromX509PEM(client.getSecret());
} catch (Throwable t) {
warn("could not decode public key for client=" + client.getIdentifierString() + ", message:" + t.getMessage());
request.setAttribute("client", client);
throw new RetryException("public key could not be parsed. " + t.getMessage());
}
fireNewClientEvent(client);
return client;
}
Aggregations