mirror of
https://github.com/octoleo/plantuml-server.git
synced 2024-11-18 02:05:12 +00:00
Merge pull request #105 from norbitheeviljester/master
Added support for Authorization header
This commit is contained in:
commit
cd65d5719a
@ -83,7 +83,9 @@ You can set all the following variables:
|
|||||||
* `PLANTUML_STATS`
|
* `PLANTUML_STATS`
|
||||||
* Set it to `on` to enable [statistics report](http://plantuml.com/statistics-report)
|
* Set it to `on` to enable [statistics report](http://plantuml.com/statistics-report)
|
||||||
* Default value `off`
|
* Default value `off`
|
||||||
|
* `HTTP_AUTHORIZATION`
|
||||||
|
* when calling the `proxy` endpoint, the value of `HTTP_AUTHORIZATION` will be used to set the HTTP Authorization header
|
||||||
|
* Default value: null
|
||||||
|
|
||||||
|
|
||||||
Alternate: How to build your docker image
|
Alternate: How to build your docker image
|
||||||
|
@ -135,20 +135,18 @@ public class ProxyServlet extends HttpServlet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private HttpURLConnection getConnection(final URL url) throws IOException {
|
private HttpURLConnection getConnection(final URL url) throws IOException {
|
||||||
if (url.getProtocol().startsWith("https")) {
|
final HttpURLConnection con = (HttpURLConnection) url.openConnection();
|
||||||
HttpsURLConnection con = (HttpsURLConnection) url.openConnection();
|
if (con instanceof HttpsURLConnection) {
|
||||||
con.setRequestMethod("GET");
|
// printHttpsCert((HttpsURLConnection) con);
|
||||||
con.setReadTimeout(10000); // 10 seconds
|
|
||||||
// printHttpsCert(con);
|
|
||||||
con.connect();
|
|
||||||
return con;
|
|
||||||
} else {
|
|
||||||
HttpURLConnection con = (HttpURLConnection) url.openConnection();
|
|
||||||
con.setRequestMethod("GET");
|
|
||||||
con.setReadTimeout(10000); // 10 seconds
|
|
||||||
con.connect();
|
|
||||||
return con;
|
|
||||||
}
|
}
|
||||||
|
con.setRequestMethod("GET");
|
||||||
|
String token = System.getenv("HTTP_AUTHORIZATION");
|
||||||
|
if (token != null) {
|
||||||
|
con.setRequestProperty("Authorization", token);
|
||||||
|
}
|
||||||
|
con.setReadTimeout(10000); // 10 seconds
|
||||||
|
con.connect();
|
||||||
|
return con;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user