@Nonnull @Override protected Event doExecute( final @Nonnull RequestContext springRequestContext, final @Nonnull ProfileRequestContext profileRequestContext) { final ParameterMap params = springRequestContext.getRequestParameters(); final String service = params.get(ProtocolParam.Service.id()); if (service == null) { return ProtocolError.ServiceNotSpecified.event(this); } final String ticket = params.get(ProtocolParam.Ticket.id()); if (ticket == null) { return ProtocolError.TicketNotSpecified.event(this); } final TicketValidationRequest ticketValidationRequest = new TicketValidationRequest(service, ticket); final String renew = params.get(ProtocolParam.Renew.id()); if (renew != null) { ticketValidationRequest.setRenew(true); } ticketValidationRequest.setPgtUrl(params.get(ProtocolParam.PgtUrl.id())); final MessageContext messageContext = new MessageContext(); messageContext.setMessage(ticketValidationRequest); profileRequestContext.setInboundMessageContext(messageContext); FlowStateSupport.setTicketValidationRequest(springRequestContext, ticketValidationRequest); return ActionSupport.buildProceedEvent(this); }
/** {@inheritDoc} */ @Override protected boolean doPreExecute(@Nonnull final ProfileRequestContext profileRequestContext) { if (!super.doPreExecute(profileRequestContext)) { return false; } final RequestContext requestContext = getRequestContext(profileRequestContext); if (requestContext == null) { log.error("{} Spring RequestContext is not set", getLogPrefix()); ActionSupport.buildEvent(profileRequestContext, EventIds.UNABLE_TO_DECODE); return false; } final String sessionRef = requestContext.getRequestParameters().get(SESSION_PARAM_BYREF); final String sessionVal = requestContext.getRequestParameters().get(SESSION_PARAM_BYVAL); try { if (sessionRef != null) { sessionKey = sessionRef; session = getSessionByReference(requestContext, sessionKey); } else if (sessionVal != null) { session = getSessionByValue(sessionVal); } else { log.warn("{} No session parameter provided, nothing to do", getLogPrefix()); ActionSupport.buildEvent(profileRequestContext, EventIds.UNABLE_TO_DECODE); return false; } log.debug("{} Got session to propagate logout: {}", getLogPrefix(), session); } catch (MessageDecodingException e) { log.warn("{} Message decoding exception: {}", e.getMessage()); ActionSupport.buildEvent(profileRequestContext, EventIds.UNABLE_TO_DECODE); return false; } catch (MessageException e) { log.warn("{} Required state not found: {}", e.getMessage()); ActionSupport.buildEvent(profileRequestContext, EventIds.INVALID_PROFILE_CTX); return false; } return true; }