All Downloads are FREE. Search and download functionalities are using the official Maven repository.

edu.uiuc.ncsa.oa4mp.oauth2.client.servlet.OA2ClientExceptionHandler Maven / Gradle / Ivy

package edu.uiuc.ncsa.oa4mp.oauth2.client.servlet;

import edu.uiuc.ncsa.myproxy.oa4mp.client.servlet.ClientExceptionHandler;
import edu.uiuc.ncsa.myproxy.oa4mp.client.servlet.ClientServlet;
import edu.uiuc.ncsa.security.oauth_2_0.OA2Constants;
import edu.uiuc.ncsa.security.oauth_2_0.OA2Error;
import edu.uiuc.ncsa.security.servlet.JSPUtil;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * 

Created by Jeff Gaynor
* on 2/12/15 at 1:16 PM */ public class OA2ClientExceptionHandler extends ClientExceptionHandler { public OA2ClientExceptionHandler(ClientServlet clientServlet) { super(clientServlet); } @Override public void handleException(Throwable t, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { if(t instanceof OA2Error){ OA2Error oa2Error = (OA2Error)t; request.setAttribute(OA2Constants.ERROR, oa2Error.getError()); request.setAttribute(OA2Constants.ERROR_DESCRIPTION, oa2Error.getDescription()); request.setAttribute(OA2Constants.STATE, oa2Error.getState()); } request.setAttribute("action", request.getContextPath()); // sets return action on error page to this web app. JSPUtil.fwd(request, response, clientServlet.getCE().getErrorPagePath()); } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy