use of edu.uiuc.ncsa.myproxy.NoUsableMyProxyServerFoundException in project OA4MP by ncsa.
the class AbstractAuthorizationServlet method doIt.
@Override
protected void doIt(HttpServletRequest request, HttpServletResponse response) throws Throwable {
info("*** STARTING request");
// String ag = request.getParameter(CONST(TOKEN_KEY));
String ag = getParam(request, CONST(TOKEN_KEY));
ServiceTransaction trans = null;
if (ag == null) {
throw new GeneralException("Error: Invalid request -- no token. Request rejected.");
}
trans = getAndCheckTransaction(ag);
AuthorizedState pState = new AuthorizedState(getState(request), request, response, trans);
prepare(pState);
preprocess(new TransactionState(request, response, null, trans));
switch(pState.getState()) {
case AUTHORIZATION_ACTION_OK:
// As per the spec, if the code gets to here then authentication worked.
trans.setAuthGrantValid(true);
getTransactionStore().save(trans);
// get the cert and store it. Then forward user.
try {
createRedirect(request, response, trans);
// at this point.
return;
} catch (ConnectionException ce) {
ce.printStackTrace();
request.setAttribute(RETRY_MESSAGE, getServiceEnvironment().getMessages().get(RETRY_MESSAGE));
pState.setState(AUTHORIZATION_ACTION_START);
prepare(pState);
} catch (GeneralSecurityException | NoUsableMyProxyServerFoundException t) {
// CIL-173 fix: process NoUsableMPSFound.
info("Prompting user to retry");
request.setAttribute(RETRY_MESSAGE, getServiceEnvironment().getMessages().get(RETRY_MESSAGE));
pState.setState(AUTHORIZATION_ACTION_START);
prepare(pState);
}
break;
case AUTHORIZATION_ACTION_START:
// no processing needed for initial request.
break;
default:
}
present(pState);
}
Aggregations