You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@drill.apache.org by vi...@apache.org on 2019/03/01 12:22:39 UTC
[drill] branch master updated: DRILL-7052: Relative path for URL
redirection
This is an automated email from the ASF dual-hosted git repository.
vitalii pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/drill.git
The following commit(s) were added to refs/heads/master by this push:
new fee4b1c DRILL-7052: Relative path for URL redirection
fee4b1c is described below
commit fee4b1cdc1a1bf4ac3dfdbbf435a5696540ce59a
Author: Vitalii Diravka <vi...@gmail.com>
AuthorDate: Sat Feb 23 21:51:48 2019 +0200
DRILL-7052: Relative path for URL redirection
---
.../yarn/appMaster/http/AuthDynamicFeature.java | 6 ++--
.../drill/yarn/appMaster/http/WebUiPageTree.java | 2 +-
drill-yarn/src/main/resources/drill-am/login.ftl | 2 +-
.../exec/server/rest/LogInLogOutResources.java | 2 +-
.../exec/server/rest/auth/AuthDynamicFeature.java | 5 ++-
exec/java-exec/src/main/resources/rest/login.ftl | 37 +++++++++++-----------
.../src/main/resources/rest/mainLogin.ftl | 26 +++++++--------
7 files changed, 38 insertions(+), 42 deletions(-)
diff --git a/drill-yarn/src/main/java/org/apache/drill/yarn/appMaster/http/AuthDynamicFeature.java b/drill-yarn/src/main/java/org/apache/drill/yarn/appMaster/http/AuthDynamicFeature.java
index c882fe0..3a17478 100644
--- a/drill-yarn/src/main/java/org/apache/drill/yarn/appMaster/http/AuthDynamicFeature.java
+++ b/drill-yarn/src/main/java/org/apache/drill/yarn/appMaster/http/AuthDynamicFeature.java
@@ -33,7 +33,6 @@ import javax.ws.rs.container.ResourceInfo;
import javax.ws.rs.core.FeatureContext;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.SecurityContext;
-import java.io.IOException;
import java.net.URI;
import java.net.URLEncoder;
@@ -83,13 +82,12 @@ public class AuthDynamicFeature implements DynamicFeature {
private static AuthCheckFilter INSTANCE = new AuthCheckFilter();
@Override
- public void filter(ContainerRequestContext requestContext)
- throws IOException {
+ public void filter(ContainerRequestContext requestContext) {
final SecurityContext sc = requestContext.getSecurityContext();
if (!isUserLoggedIn(sc)) {
try {
final String destResource = URLEncoder.encode(
- requestContext.getUriInfo().getRequestUri().toString(), "UTF-8");
+ requestContext.getUriInfo().getRequestUri().getPath(), "UTF-8");
final URI loginURI = requestContext.getUriInfo().getBaseUriBuilder()
.path(LogInLogOutPages.LOGIN_RESOURCE)
.queryParam(LogInLogOutPages.REDIRECT_QUERY_PARM, destResource)
diff --git a/drill-yarn/src/main/java/org/apache/drill/yarn/appMaster/http/WebUiPageTree.java b/drill-yarn/src/main/java/org/apache/drill/yarn/appMaster/http/WebUiPageTree.java
index fc44e45..58a59d3 100644
--- a/drill-yarn/src/main/java/org/apache/drill/yarn/appMaster/http/WebUiPageTree.java
+++ b/drill-yarn/src/main/java/org/apache/drill/yarn/appMaster/http/WebUiPageTree.java
@@ -117,7 +117,7 @@ public class WebUiPageTree extends PageTree {
final HttpSession session = request.getSession(true);
final URI destURI = UriBuilder
.fromUri(URLDecoder.decode(redirect, "UTF-8")).build();
- session.setAttribute(FormAuthenticator.__J_URI, destURI.toString());
+ session.setAttribute(FormAuthenticator.__J_URI, destURI.getPath());
}
return new Viewable("/drill-am/login.ftl", toModel(sc, (Object) null));
diff --git a/drill-yarn/src/main/resources/drill-am/login.ftl b/drill-yarn/src/main/resources/drill-am/login.ftl
index 3f34a51..e7fdc48 100644
--- a/drill-yarn/src/main/resources/drill-am/login.ftl
+++ b/drill-yarn/src/main/resources/drill-am/login.ftl
@@ -40,4 +40,4 @@
</form>
</div>
</#macro>
-<@page_html/>
\ No newline at end of file
+<@page_html/>
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/LogInLogOutResources.java b/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/LogInLogOutResources.java
index 324b701..0abe2c5 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/LogInLogOutResources.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/LogInLogOutResources.java
@@ -69,7 +69,7 @@ public class LogInLogOutResources {
// is forwarded to the redirect page.
final HttpSession session = request.getSession(true);
final URI destURI = UriBuilder.fromUri(URLDecoder.decode(redirect, "UTF-8")).build();
- session.setAttribute(FormAuthenticator.__J_URI, destURI.toString());
+ session.setAttribute(FormAuthenticator.__J_URI, destURI.getPath());
}
}
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/auth/AuthDynamicFeature.java b/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/auth/AuthDynamicFeature.java
index 7bcf430..fc69521 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/auth/AuthDynamicFeature.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/auth/AuthDynamicFeature.java
@@ -31,7 +31,6 @@ import javax.ws.rs.container.ResourceInfo;
import javax.ws.rs.core.FeatureContext;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.SecurityContext;
-import java.io.IOException;
import java.net.URI;
import java.net.URLEncoder;
@@ -75,12 +74,12 @@ public class AuthDynamicFeature implements DynamicFeature {
private static AuthCheckFilter INSTANCE = new AuthCheckFilter();
@Override
- public void filter(ContainerRequestContext requestContext) throws IOException {
+ public void filter(ContainerRequestContext requestContext) {
final SecurityContext sc = requestContext.getSecurityContext();
if (!isUserLoggedIn(sc)) {
try {
final String destResource =
- URLEncoder.encode(requestContext.getUriInfo().getRequestUri().toString(), "UTF-8");
+ URLEncoder.encode(requestContext.getUriInfo().getRequestUri().getPath(), "UTF-8");
final URI loginURI = requestContext.getUriInfo().getBaseUriBuilder()
.path(WebServerConstants.MAIN_LOGIN_RESOURCE_NAME)
.queryParam(WebServerConstants.REDIRECT_QUERY_PARM, destResource)
diff --git a/exec/java-exec/src/main/resources/rest/login.ftl b/exec/java-exec/src/main/resources/rest/login.ftl
index 790c934..19cd12b 100644
--- a/exec/java-exec/src/main/resources/rest/login.ftl
+++ b/exec/java-exec/src/main/resources/rest/login.ftl
@@ -22,23 +22,22 @@
</#macro>
<#macro page_body>
- <div class="page-header"></div>
- <div align="center" class="table-responsive">
- <form role="form" name="input" action="/j_security_check" method="POST">
- <fieldset>
- <div class="form-group">
- <img src="/static/img/apache-drill-logo.png" alt="Apache Drill Logo">
- <#if model??>
- <p style="color:red">${model}</p></br>
- </#if>
- <h4>Log In to Drill Web Console</h4></br>
- <p><input type="text" size="30" name="j_username" placeholder="Username"></p>
- <p><input type="password" size="30" name="j_password" placeholder="Password"></p>
- <p><button type="submit" class="btn btn-default">Log In</button> </p>
- </div>
-
- </fieldset>
- </form>
- </div>
+ <div class="page-header"></div>
+ <div align="center" class="table-responsive">
+ <form role="form" name="input" action="/j_security_check" method="POST">
+ <fieldset>
+ <div class="form-group">
+ <img src="/static/img/apache-drill-logo.png" alt="Apache Drill Logo">
+ <#if model??>
+ <p style="color:red">${model}</p></br>
+ </#if>
+ <h4>Log In to Drill Web Console</h4></br>
+ <p><input type="text" size="30" name="j_username" placeholder="Username"></p>
+ <p><input type="password" size="30" name="j_password" placeholder="Password"></p>
+ <p><button type="submit" class="btn btn-default">Log In</button> </p>
+ </div>
+ </fieldset>
+ </form>
+ </div>
</#macro>
-<@page_html/>
\ No newline at end of file
+<@page_html/>
diff --git a/exec/java-exec/src/main/resources/rest/mainLogin.ftl b/exec/java-exec/src/main/resources/rest/mainLogin.ftl
index 1e3a5a9..64f1fee 100644
--- a/exec/java-exec/src/main/resources/rest/mainLogin.ftl
+++ b/exec/java-exec/src/main/resources/rest/mainLogin.ftl
@@ -22,20 +22,20 @@
</#macro>
<#macro page_body>
- <div class="page-header">
- </div>
- <div class="container container-table">
- <div align="center" class="table-responsive">
- <#if model?? && model.isFormEnabled()>
+ <div class="page-header">
+ </div>
+ <div class="container container-table">
+ <div align="center" class="table-responsive">
+ <#if model?? && model.isFormEnabled()>
<a href ="/login" class="btn btn-primary"> Login using FORM AUTHENTICATION </a>
- </#if>
- <#if model?? && model.isSpnegoEnabled()>
+ </#if>
+ <#if model?? && model.isSpnegoEnabled()>
<a href = "/spnegoLogin" class="btn btn-primary"> Login using SPNEGO </a>
- </#if>
- <#if model?? && model.getError()??>
+ </#if>
+ <#if model?? && model.getError()??>
<p style="color:red">${model.getError()}</p></br>
- </#if>
- </div>
- </div>
+ </#if>
+ </div>
+ </div>
</#macro>
-<@page_html/>
\ No newline at end of file
+<@page_html/>