mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-29 10:03:43 -05:00
pass client ip as url param
This commit is contained in:
parent
3c28b30680
commit
b1262ff06e
1 changed files with 7 additions and 2 deletions
|
@ -133,7 +133,11 @@ public class Oauth2Filter implements Filter {
|
||||||
|
|
||||||
String authHeader = request.getHeader("Authorization");
|
String authHeader = request.getHeader("Authorization");
|
||||||
if (authHeader != null) {
|
if (authHeader != null) {
|
||||||
Log.info("[{}] Authorization header present");
|
String clientIp = request.getHeader("X-Forwarded-For");
|
||||||
|
if (clientIp == null) {
|
||||||
|
clientIp = request.getRemoteAddr();
|
||||||
|
}
|
||||||
|
Log.info("[{}] Authorization header present", clientIp);
|
||||||
StringTokenizer st = new StringTokenizer(authHeader);
|
StringTokenizer st = new StringTokenizer(authHeader);
|
||||||
if (st.hasMoreTokens()) {
|
if (st.hasMoreTokens()) {
|
||||||
String basic = st.nextToken();
|
String basic = st.nextToken();
|
||||||
|
@ -157,7 +161,8 @@ public class Oauth2Filter implements Filter {
|
||||||
Instance.jsonFactory,
|
Instance.jsonFactory,
|
||||||
new GenericUrl(
|
new GenericUrl(
|
||||||
oauth2.getOauth2Server()
|
oauth2.getOauth2Server()
|
||||||
+ "/oauth/token"
|
+ "/oauth/token?client_ip="
|
||||||
|
+ clientIp
|
||||||
),
|
),
|
||||||
username,
|
username,
|
||||||
password
|
password
|
||||||
|
|
Loading…
Reference in a new issue