protected final String checkRequiredParameter(final HttpServletRequest request, final String parameterName, final Map<String, Message> errorMessages, final String messageKey) { if (StringUtils.isBlank(request.getParameter(parameterName))) { errorMessages.put(parameterName, messageFactory.newI18nMessage(messageKey)); } return request.getParameter(parameterName); }
protected String getRequiredParameter(final HttpServletRequest request, final String name) throws BadRequestException { final String value = request.getParameter(name); if (StringUtils.isBlank(value)) { throw new BadRequestException(messageFactory.newI18nMessage("auth.config.parameter.missing", name)); } else { return value; } }
public static String getRequiredParameter(final HttpServletRequest request, final MessageFactory messageFactory, final String name) throws BadRequestException { final String value = request.getParameter(name); if (StringUtils.isBlank(value)) { throw new BadRequestException(messageFactory.newI18nMessage("auth.config.parameter.missing", name)); } else { return value; } } }
private String relativitize(String uri, final URI supposedlyBaseUri, final String parameterName, final String messageKey, Map<String, Message> errorMessages) throws IllegalArgumentException { try { return relativitize(uri, supposedlyBaseUri); } catch (IllegalArgumentException iae) { errorMessages.put(parameterName, messageFactory.newI18nMessage(messageKey)); return uri; } }
private AbstractApplinksServlet.BadRequestException createBadRequestException(final String redirectUri) { return new AbstractApplinksServlet.BadRequestException(messageFactory.newI18nMessage("auth.config.parameter.callback.invalid", redirectUri)); } }
protected String getRequiredParameter(final HttpServletRequest request, final String name) throws BadRequestException { final String value = request.getParameter(name); if (StringUtils.isBlank(value)) { throw new BadRequestException(messageFactory.newI18nMessage("auth.config.parameter.missing", name)); } else { return value; } }
private AbstractApplinksServlet.BadRequestException createBadRequestException(final String redirectUri) { return new AbstractApplinksServlet.BadRequestException(messageFactory.newI18nMessage("auth.config.parameter.callback.invalid", redirectUri)); } }
public static String getRequiredParameter(final HttpServletRequest request, final MessageFactory messageFactory, final String name) throws BadRequestException { final String value = request.getParameter(name); if (StringUtils.isBlank(value)) { throw new BadRequestException(messageFactory.newI18nMessage("auth.config.parameter.missing", name)); } else { return value; } } }
@Override protected void handleUnauthorizedAccess(HttpServletRequest request) { if (request.getUserPrincipal() != null) { throw new UnauthorizedException(messageFactory.newI18nMessage("applinks.error.only.sysadmin.operation")); } else { throw new UnauthorizedBecauseUnauthenticatedException(); } } }
@Override protected void handleUnauthorizedAccess(HttpServletRequest request) { if (request.getUserPrincipal() != null) { throw new UnauthorizedException(messageFactory.newI18nMessage("applinks.error.only.admin")); } else { throw new UnauthorizedBecauseUnauthenticatedException(); } } }
@Override protected void handleUnauthorizedAccess(HttpServletRequest request) { if (request.getUserPrincipal() != null) { throw new UnauthorizedException(messageFactory.newI18nMessage("applinks.error.only.admin")); } else { throw new UnauthorizedBecauseUnauthenticatedException(); } } }
@Override protected void handleUnauthorizedAccess(HttpServletRequest request) { if (request.getUserPrincipal() != null) { throw new UnauthorizedException(messageFactory.newI18nMessage("applinks.error.only.sysadmin.operation")); } else { throw new UnauthorizedBecauseUnauthenticatedException(); } } }
private void assertPermission(final Class<? extends EntityType> entityType, final String key) { if (!internalHostApplication.canManageEntityLinksFor( internalHostApplication.toEntityReference(key, entityType))) { throw new AbstractApplinksServlet.UnauthorizedException(messageFactory.newI18nMessage("applinks.entity.list.no.permission")); } }
protected Action getAction(final HttpServletRequest request) { final String value = getRequiredParameter(request, "action"); try { return Action.valueOf(value); } catch (IllegalArgumentException e) { throw new BadRequestException(messageFactory.newI18nMessage("auth.trusted.config.reciprocal.action.missing", value)); } }
private void parsePathParams(final String typeId) { if (!internalHostApplication.doesEntityExist(key, typeAccessor.loadEntityType(typeId).getClass())) { throw new AbstractApplinksServlet.BadRequestException(messageFactory.newLocalizedMessage( String.format("No entity exists with key %s of type %s", key, typeId))); } final EntityType entityType = typeAccessor.loadEntityType(typeId); assertPermission(entityType.getClass(), key); final EntityReference entityReference = internalHostApplication.toEntityReference(key, entityType.getClass()); type = typeId; typeLabel = messageFactory.newI18nMessage(entityType.getShortenedI18nKey()).toString(); name = entityReference.getName(); }
private void processPeerResponse(final HttpServletRequest request, final HttpServletResponse response, final ApplicationLink link) throws IOException { // returned from peer final RendererContextBuilder contextBuilder = new RendererContextBuilder(); if (!peerWasSuccessful(request)) { contextBuilder.put("error", messageFactory.newI18nMessage("auth.trusted.config.consumer.save.peer.failed", request.getParameter("message"))); } render(link, request, response, contextBuilder.build()); }
logger.warn(String.format("Unable to load ApplicationLink %s due to uninstalled type definition (%s).", id.toString(), e.getType()), e); throw new NotFoundException(messageFactory.newI18nMessage("auth.config.applink.notfound", id.toString())); throw new BadRequestException(messageFactory.newI18nMessage("auth.config.applinkpath.missing"));
logger.warn(String.format("Unable to load ApplicationLink %s due to uninstalled type definition (%s).", id.toString(), e.getType()), e); throw new AbstractApplinksServlet.NotFoundException(messageFactory.newI18nMessage("auth.config.applink.notfound", id.toString())); throw new AbstractApplinksServlet.BadRequestException(messageFactory.newI18nMessage("auth.config.applinkpath.missing"));
throw new AbstractApplinksServlet.NotFoundException(messageFactory.newI18nMessage("auth.config.applink.notfound", id.toString())); throw new AbstractApplinksServlet.BadRequestException(messageFactory.newI18nMessage("auth.config.applinkpath.missing"));
throw new NotFoundException(messageFactory.newI18nMessage("auth.config.applink.notfound", id.toString())); throw new BadRequestException(messageFactory.newI18nMessage("auth.config.applinkpath.missing"));