package at.gv.egovernment.moa.id.auth.modules.eidas; import java.io.IOException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import at.gv.egiz.eaaf.core.impl.idp.controller.AbstractProcessEngineSignalController; import at.gv.egovernment.moa.id.protocols.oauth20.OAuth20Constants; import at.gv.egovernment.moa.id.util.CookieUtils; import at.gv.egovernment.moa.logging.Logger; import at.gv.egovernment.moa.util.MiscUtil; @Controller public class eID4UAPSignalServlet extends AbstractProcessEngineSignalController { public eID4UAPSignalServlet() { Logger.debug("Registering servlet " + getClass().getName() + " with mappings '"+ eID4UConstants.HTTP_ENDPOINT_AP_CONSENT_RETURN + "'."); } @RequestMapping(value = {eID4UConstants.HTTP_ENDPOINT_AP_CONSENT_RETURN }, method = {RequestMethod.POST, RequestMethod.GET}) public void performCitizenCardAuthentication(HttpServletRequest req, HttpServletResponse resp) throws IOException { signalProcessManagement(req, resp); } @Override /** * Protocol specific implementation to get the pending-requestID * from http request object * * @param request The http Servlet-Request object * @return The Pending-request id * */ public String getPendingRequestId(HttpServletRequest request) { String pendigReqId = super.getPendingRequestId(request); if (MiscUtil.isEmpty(pendigReqId)) { Logger.trace("No 'pendingReqID', seach for 'state' parameter in eID4U use-case ... "); pendigReqId = request.getParameter(OAuth20Constants.PARAM_STATE); if (MiscUtil.isEmpty(pendigReqId)) { Logger.trace("No 'pendingReqID', seach HTTP-Cookie in eID4U use-case ... "); pendigReqId = CookieUtils.getValueFromCookie(request, eID4UConstants.HTTP_TRANSACTION_COOKIE_NAME); if (MiscUtil.isEmpty(pendigReqId)) Logger.info("NO eID4U cookie or 'state' parameter with pendingReqId."); } } return pendigReqId; } }