private void parseAccessToken(RoutingContext context, Handler<AsyncResult<String>> handler) { final HttpServerRequest request = context.request(); final String authorization = request.headers().get(HttpHeaders.AUTHORIZATION); if (authorization == null) { handler.handle(Future.failedFuture(new InvalidTokenException("An access token is required"))); return; } int idx = authorization.indexOf(' '); if (idx <= 0 || !BEARER.equalsIgnoreCase(authorization.substring(0, idx))) { handler.handle(Future.failedFuture(new InvalidTokenException("The access token must be sent using the Authorization header field"))); return; } handler.handle(Future.succeededFuture(authorization.substring(idx + 1))); }
private void parseAccessToken(RoutingContext context, Handler<AsyncResult<String>> handler) { final HttpServerRequest request = context.request(); final String authorization = request.headers().get(HttpHeaders.AUTHORIZATION); if (authorization == null) { handler.handle(Future.failedFuture(new InvalidTokenException("An access token is required"))); return; } int idx = authorization.indexOf(' '); if (idx <= 0 || !BEARER.equalsIgnoreCase(authorization.substring(0, idx))) { handler.handle(Future.failedFuture(new InvalidTokenException("The access token must be sent using the Authorization header field"))); return; } handler.handle(Future.succeededFuture(authorization.substring(idx + 1))); }
private boolean returnFromLoginPage(RoutingContext context) { String referer = context.request().headers().get(HttpHeaders.REFERER); try { return referer != null && UriBuilder.fromURIString(referer).build().getPath().contains('/' + domain.getPath() + "/login"); } catch (URISyntaxException e) { logger.debug("Unable to calculate referer url : {}", referer, e); return false; } } }
private boolean returnFromLoginPage(RoutingContext context) { String referer = context.request().headers().get(HttpHeaders.REFERER); try { return referer != null && UriBuilder.fromURIString(referer).build().getPath().contains('/' + domain.getPath() + "/login"); } catch (URISyntaxException e) { logger.debug("Unable to calculate referer url : {}", referer, e); return false; } } }
public ClientRequest(HttpServerRequest serverRequest) { this.path = serverRequest.path(); this.method = serverRequest.method(); this.headers = MultiMap.caseInsensitiveMultiMap().setAll(serverRequest.headers()); this.params = UriHelper.getParams(serverRequest.uri()); this.formAttributes = MultiMap.caseInsensitiveMultiMap().setAll(serverRequest.formAttributes()); }
public ClientRequest(HttpServerRequest serverRequest) { this.path = serverRequest.path(); this.method = serverRequest.method(); this.headers = MultiMap.caseInsensitiveMultiMap().setAll(serverRequest.headers()); this.params = UriHelper.getParams(serverRequest.uri()); this.formAttributes = MultiMap.caseInsensitiveMultiMap().setAll(serverRequest.formAttributes()); }