|
27 | 27 |
|
28 | 28 | import org.apache.commons.io.IOUtils; |
29 | 29 | import org.apache.commons.lang3.StringUtils; |
| 30 | +import org.apache.http.HttpHeaders; |
30 | 31 | import org.apache.http.NameValuePair; |
31 | 32 | import org.apache.http.client.utils.URLEncodedUtils; |
32 | 33 | import org.apache.logging.log4j.LogManager; |
33 | 34 | import org.apache.logging.log4j.Logger; |
34 | 35 |
|
35 | 36 | import java.io.IOException; |
36 | | -import java.io.OutputStream; |
37 | 37 | import java.net.InetSocketAddress; |
38 | 38 | import java.net.URI; |
39 | 39 | import java.nio.charset.Charset; |
40 | | -import java.nio.charset.StandardCharsets; |
41 | 40 | import java.util.List; |
42 | 41 | import java.util.concurrent.CountDownLatch; |
43 | 42 | import java.util.concurrent.Executors; |
@@ -87,12 +86,8 @@ public void handle(final HttpExchange exchange) throws IOException { |
87 | 86 | } |
88 | 87 | final OAuth2TokenListenerRegistry oauth = OAuth2TokenListenerRegistry.get(); |
89 | 88 | if(oauth.notify(state, code)) { |
90 | | - final String response = "<!DOCTYPE html><html><body><script>window.close();</script></body></html>"; |
91 | | - exchange.getResponseHeaders().add("Content-Type", "text/html; charset=UTF-8"); |
92 | | - exchange.sendResponseHeaders(200, response.getBytes(StandardCharsets.UTF_8).length); |
93 | | - try(final OutputStream os = exchange.getResponseBody()) { |
94 | | - os.write(response.getBytes(StandardCharsets.UTF_8)); |
95 | | - } |
| 89 | + exchange.getResponseHeaders().add(HttpHeaders.LOCATION, OAuth2AuthorizationService.CYBERDUCK_REDIRECT_URI); |
| 90 | + exchange.sendResponseHeaders(302, 0L); |
96 | 91 | } |
97 | 92 | else { |
98 | 93 | exchange.sendResponseHeaders(400, 0); |
|
0 commit comments