@Override
  public Optional<String> getReturnTo(HttpRequest request) {
    return getParameter(request, RETURN_TO_PARAMETER)
      .flatMap(OAuth2AuthenticationParametersImpl::sanitizeRedirectUrl);
  }
@Test
  public void get_return_to_parameter() {
    when(request.getCookies()).thenReturn(new Cookie[]{wrapCookie(AUTHENTICATION_COOKIE_NAME, "{\"return_to\":\"/admin/settings\"}")});

    Optional<String> redirection = underTest.getReturnTo(request);

    assertThat(redirection).contains("/admin/settings");
  }