private ModelAndView generateErrorView(string code, string description, Object[] args) { ModelAndView modelAndView = new ModelAndView(this.failureView); //string convertedDescription = getMessageSourceAccessor().getMessage(description, args, description); modelAndView.addObject("code", code); //modelAndView.addObject("description", convertedDescription); return modelAndView; }
private ModelAndView generateErrorView(string code, string description, Object[] args) { ModelAndView modelAndView = new ModelAndView(this.failureView); //string convertedDescription = getMessageSourceAccessor().getMessage(description, args, description); modelAndView.addObject("code", code); //modelAndView.addObject("description", convertedDescription); return(modelAndView); }
private ModelAndView generateErrorView(string code, string description, Object[] args) { ModelAndView modelAndView = new ModelAndView(CONST_PROXY_FAILURE); modelAndView.addObject("code", code); //modelAndView.addObject("description", getMessageSourceAccessor() // .getMessage(description, args, description)); return(modelAndView); }
private ModelAndView generateErrorView( string code, string description, Object[] args) { ModelAndView modelAndView = new ModelAndView(CONST_PROXY_FAILURE); modelAndView.addObject("code", code); //modelAndView.addObject("description", getMessageSourceAccessor() // .getMessage(description, args, description)); return modelAndView; }
protected ModelAndView handleRequestInternal(HttpRequest request, HttpResponse response) { WebApplicationService service = this.argumentExtractor.extractService(request); string serviceTicketId = service != null ? service.getArtifactId() : null; if (service == null || serviceTicketId == null) { //if (logger.isDebugEnabled()) { // logger.debug(string.format("Could not process request; Service: %s, Service Ticket Id: %s", service, serviceTicketId)); //} return this.generateErrorView("INVALID_REQUEST", "INVALID_REQUEST", null); } try { Credentials serviceCredentials = this.getServiceCredentialsFromRequest(request); string proxyGrantingTicketId = null; // XXX should be able to validate AND THEN use if (serviceCredentials != null) { try { proxyGrantingTicketId = this.centralAuthenticationService .delegateTicketGrantingTicket(serviceTicketId, serviceCredentials); } catch (TicketException e) { //logger.error("TicketException generating ticket for: " // + serviceCredentials, e); } } Assertion assertion = this.centralAuthenticationService.validateServiceTicket(serviceTicketId, service); ValidationSpecification validationSpecification = this.getCommandClass(); ServletRequestDataBinder binder = new ServletRequestDataBinder(validationSpecification, "validationSpecification"); this.initBinder(request, binder); binder.bind(request); if (!validationSpecification.isSatisfiedBy(assertion)) { //if (logger.isDebugEnabled()) { // logger.debug("ServiceTicket [" + serviceTicketId + "] does not satisfy validation specification."); //} return this.generateErrorView("INVALID_TICKET", "INVALID_TICKET_SPEC", null); } this.onSuccessfulValidation(serviceTicketId, assertion); ModelAndView success = new ModelAndView(this.successView); success.addObject(MODEL_ASSERTION, assertion); if (serviceCredentials != null && proxyGrantingTicketId != null) { string proxyIou = this.proxyHandler.handle(serviceCredentials, proxyGrantingTicketId); success.addObject(MODEL_PROXY_GRANTING_TICKET_IOU, proxyIou); } //if (logger.isDebugEnabled()) { // logger.debug(string.format("Successfully validated service ticket: %s", serviceTicketId)); //} return success; } catch (TicketValidationException e) { return this.generateErrorView(e.getCode(), e.getCode(), new Object[] { serviceTicketId, e.getOriginalService().getId(), service.getId() }); } catch (TicketException te) { return this.generateErrorView(te.getCode(), te.getCode(), new Object[] { serviceTicketId }); } catch (UnauthorizedServiceException e) { //return generateErrorView(e.getMessage(), e.getMessage(), null); throw new NotImplementedException(); } }
protected ModelAndView handleRequestInternal(HttpRequest request, HttpResponse response) { WebApplicationService service = this.argumentExtractor.extractService(request); string serviceTicketId = service != null?service.getArtifactId() : null; if (service == null || serviceTicketId == null) { //if (logger.isDebugEnabled()) { // logger.debug(string.format("Could not process request; Service: %s, Service Ticket Id: %s", service, serviceTicketId)); //} return(this.generateErrorView("INVALID_REQUEST", "INVALID_REQUEST", null)); } try { Credentials serviceCredentials = this.getServiceCredentialsFromRequest(request); string proxyGrantingTicketId = null; // XXX should be able to validate AND THEN use if (serviceCredentials != null) { try { proxyGrantingTicketId = this.centralAuthenticationService .delegateTicketGrantingTicket(serviceTicketId, serviceCredentials); } catch (TicketException e) { //logger.error("TicketException generating ticket for: " // + serviceCredentials, e); } } Assertion assertion = this.centralAuthenticationService.validateServiceTicket(serviceTicketId, service); ValidationSpecification validationSpecification = this.getCommandClass(); ServletRequestDataBinder binder = new ServletRequestDataBinder(validationSpecification, "validationSpecification"); this.initBinder(request, binder); binder.bind(request); if (!validationSpecification.isSatisfiedBy(assertion)) { //if (logger.isDebugEnabled()) { // logger.debug("ServiceTicket [" + serviceTicketId + "] does not satisfy validation specification."); //} return(this.generateErrorView("INVALID_TICKET", "INVALID_TICKET_SPEC", null)); } this.onSuccessfulValidation(serviceTicketId, assertion); ModelAndView success = new ModelAndView(this.successView); success.addObject(MODEL_ASSERTION, assertion); if (serviceCredentials != null && proxyGrantingTicketId != null) { string proxyIou = this.proxyHandler.handle(serviceCredentials, proxyGrantingTicketId); success.addObject(MODEL_PROXY_GRANTING_TICKET_IOU, proxyIou); } //if (logger.isDebugEnabled()) { // logger.debug(string.format("Successfully validated service ticket: %s", serviceTicketId)); //} return(success); } catch (TicketValidationException e) { return(this.generateErrorView(e.getCode(), e.getCode(), new Object[] { serviceTicketId, e.getOriginalService().getId(), service.getId() })); } catch (TicketException te) { return(this.generateErrorView(te.getCode(), te.getCode(), new Object[] { serviceTicketId })); } catch (UnauthorizedServiceException e) { //return generateErrorView(e.getMessage(), e.getMessage(), null); throw new NotImplementedException(); } }