@Override public String toString() { return getClass().getSimpleName() + " [delegate=" + getDelegate() + "]"; }
private String expandRedirectUri(ServerHttpRequest request, ClientRegistration clientRegistration) { // Supported URI variables -> baseUrl, action, registrationId // Used in -> CommonOAuth2Provider.DEFAULT_REDIRECT_URL = "{baseUrl}/{action}/oauth2/code/{registrationId}" Map<String, String> uriVariables = new HashMap<>(); uriVariables.put("registrationId", clientRegistration.getRegistrationId()); String baseUrl = UriComponentsBuilder.fromHttpRequest(new ServerHttpRequestDecorator(request)) .replacePath(request.getPath().contextPath().value()) .replaceQuery(null) .build() .toUriString(); uriVariables.put("baseUrl", baseUrl); if (AuthorizationGrantType.AUTHORIZATION_CODE.equals(clientRegistration.getAuthorizationGrantType())) { String loginAction = "login"; uriVariables.put("action", loginAction); } return UriComponentsBuilder.fromUriString(clientRegistration.getRedirectUriTemplate()) .buildAndExpand(uriVariables) .toUriString(); } }
PartnerServerHttpRequestDecorator(ServerHttpRequest delegate) { super(delegate); final String path = delegate.getURI().getPath(); final String query = delegate.getURI().getQuery(); final String method = Optional.ofNullable(delegate.getMethod()).orElse(HttpMethod.GET).name(); final String headers = delegate.getHeaders().entrySet() .stream() .map(entry -> " " + entry.getKey() + ": [" + String.join(";", entry.getValue()) + "]") .collect(Collectors.joining("\n")); final MediaType contentType = delegate.getHeaders().getContentType(); if (log.isDebugEnabled()) { log.debug("\n" + "HttpMethod : {}\n" + "Uri : {}\n" + "Headers : \n" + "{}", method, path + (StringUtils.isEmpty(query) ? "" : "?" + query), headers); } Flux<DataBuffer> flux = super.getBody(); body = flux.map(dataBuffer -> LogUtils.loggingRequest(log, dataBuffer)); body.subscribe(); }
private String expandRedirectUri(ServerHttpRequest request, ClientRegistration clientRegistration) { // Supported URI variables -> baseUrl, action, registrationId // Used in -> CommonOAuth2Provider.DEFAULT_REDIRECT_URL = "{baseUrl}/{action}/oauth2/code/{registrationId}" Map<String, String> uriVariables = new HashMap<>(); uriVariables.put("registrationId", clientRegistration.getRegistrationId()); String baseUrl = UriComponentsBuilder.fromHttpRequest(new ServerHttpRequestDecorator(request)) .replacePath(request.getPath().contextPath().value()) .replaceQuery(null) .build() .toUriString(); uriVariables.put("baseUrl", baseUrl); if (AuthorizationGrantType.AUTHORIZATION_CODE.equals(clientRegistration.getAuthorizationGrantType())) { String loginAction = "login"; uriVariables.put("action", loginAction); } return UriComponentsBuilder.fromUriString(clientRegistration.getRedirectUriTemplate()) .buildAndExpand(uriVariables) .toUriString(); } }
@Nullable @Override public SslInfo getSslInfo() { return getDelegate().getSslInfo(); }
@Override @Nullable public HttpMethod getMethod() { return getDelegate().getMethod(); }
@Override public String getId() { return getDelegate().getId(); }
@Override public HttpHeaders getHeaders() { return getDelegate().getHeaders(); }
@Override public Flux<DataBuffer> getBody() { return getDelegate().getBody(); }
@Override public URI getURI() { return getDelegate().getURI(); }
@Override public MultiValueMap<String, HttpCookie> getCookies() { return getDelegate().getCookies(); }
@Override public String getMethodValue() { return getDelegate().getMethodValue(); }
@Override public RequestPath getPath() { return getDelegate().getPath(); }
@Override public MultiValueMap<String, String> getQueryParams() { return getDelegate().getQueryParams(); }
@Override public InetSocketAddress getRemoteAddress() { return getDelegate().getRemoteAddress(); }
@Override public String toString() { return getClass().getSimpleName() + " [delegate=" + getDelegate() + "]"; }
@Nullable @Override public SslInfo getSslInfo() { return getDelegate().getSslInfo(); }
@Override public String getMethodValue() { return getDelegate().getMethodValue(); }
@Override public MultiValueMap<String, HttpCookie> getCookies() { return getDelegate().getCookies(); }
@Override public URI getURI() { return getDelegate().getURI(); }