mirror of https://github.com/apache/nifi.git
parent
552148e9e7
commit
8e61aa3c43
|
@ -33,7 +33,6 @@ import org.eclipse.jetty.server.Authentication;
|
||||||
import org.eclipse.jetty.server.Handler;
|
import org.eclipse.jetty.server.Handler;
|
||||||
import org.eclipse.jetty.server.Request;
|
import org.eclipse.jetty.server.Request;
|
||||||
import org.eclipse.jetty.server.handler.AbstractHandler;
|
import org.eclipse.jetty.server.handler.AbstractHandler;
|
||||||
import org.eclipse.jetty.util.security.Password;
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
@ -705,14 +704,12 @@ public abstract class TestInvokeHttpCommon {
|
||||||
final String response = bundle.getAttribute(InvokeHTTP.RESPONSE_BODY);
|
final String response = bundle.getAttribute(InvokeHTTP.RESPONSE_BODY);
|
||||||
assertEquals("<html>\n" +
|
assertEquals("<html>\n" +
|
||||||
"<head>\n" +
|
"<head>\n" +
|
||||||
"<meta http-equiv=\"Content-Type\" content=\"text/html;charset=ISO-8859-1\"/>\n" +
|
"<meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\"/>\n" +
|
||||||
"<title>Error 401 </title>\n" +
|
"<title>Error 401 Unauthorized</title>\n" +
|
||||||
"</head>\n" +
|
"</head>\n" +
|
||||||
"<body>\n" +
|
"<body><h2>HTTP ERROR 401</h2>\n" +
|
||||||
"<h2>HTTP ERROR: 401</h2>\n" +
|
|
||||||
"<p>Problem accessing /status/200. Reason:\n" +
|
"<p>Problem accessing /status/200. Reason:\n" +
|
||||||
"<pre> Unauthorized</pre></p>\n" +
|
"<pre> Unauthorized</pre></p><hr><a href=\"http://eclipse.org/jetty\">Powered by Jetty:// 9.4.2.v20170220</a><hr/>\n\n" +
|
||||||
"<hr /><a href=\"http://eclipse.org/jetty\">Powered by Jetty:// 9.3.9.v20160517</a><hr/>\n" +
|
|
||||||
"</body>\n" +
|
"</body>\n" +
|
||||||
"</html>\n", response);
|
"</html>\n", response);
|
||||||
}
|
}
|
||||||
|
@ -1787,18 +1784,18 @@ public abstract class TestInvokeHttpCommon {
|
||||||
|
|
||||||
private DigestAuthenticator digestAuthenticator;
|
private DigestAuthenticator digestAuthenticator;
|
||||||
|
|
||||||
private DigestAuthHandler() {
|
private DigestAuthHandler() throws Exception {
|
||||||
digestAuthenticator = new DigestAuthenticator();
|
digestAuthenticator = new DigestAuthenticator();
|
||||||
ConstraintSecurityHandler securityHandler = new ConstraintSecurityHandler();
|
ConstraintSecurityHandler securityHandler = new ConstraintSecurityHandler();
|
||||||
|
|
||||||
HashLoginService hashLoginService = new HashLoginService("realm");
|
final HashLoginService hashLoginService = new HashLoginService("realm", "src/test/resources/TestInvokeHttp/realm.properties");
|
||||||
hashLoginService.putUser("basic_user", new Password("basic_password"), new String[]{"realm"});
|
hashLoginService.start();
|
||||||
|
|
||||||
securityHandler.setLoginService(hashLoginService);
|
securityHandler.setLoginService(hashLoginService);
|
||||||
securityHandler.setIdentityService(new DefaultIdentityService());
|
securityHandler.setIdentityService(new DefaultIdentityService());
|
||||||
digestAuthenticator.setConfiguration(securityHandler);
|
digestAuthenticator.setConfiguration(securityHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse
|
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse
|
||||||
response)throws IOException, ServletException {
|
response)throws IOException, ServletException {
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
# Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
# contributor license agreements. See the NOTICE file distributed with
|
||||||
|
# this work for additional information regarding copyright ownership.
|
||||||
|
# The ASF licenses this file to You under the Apache License, Version 2.0
|
||||||
|
# (the "License"); you may not use this file except in compliance with
|
||||||
|
# the License. You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
# user: password -> MD5 of basic_user:realm:basic_password
|
||||||
|
basic_user: MD5:e051f90f38b54dece2c113f5751dc417
|
|
@ -29,7 +29,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.eclipse.jetty.websocket</groupId>
|
<groupId>org.eclipse.jetty.websocket</groupId>
|
||||||
<artifactId>websocket-server</artifactId>
|
<artifactId>websocket-server</artifactId>
|
||||||
<version>9.3.13.v20161014</version>
|
<version>${jetty.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>log4j</groupId>
|
<groupId>log4j</groupId>
|
||||||
|
|
3
pom.xml
3
pom.xml
|
@ -92,7 +92,8 @@ language governing permissions and limitations under the License. -->
|
||||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
<inceptionYear>2014</inceptionYear>
|
<inceptionYear>2014</inceptionYear>
|
||||||
<org.slf4j.version>1.7.12</org.slf4j.version>
|
<org.slf4j.version>1.7.12</org.slf4j.version>
|
||||||
<jetty.version>9.3.9.v20160517</jetty.version>
|
<!--<jetty.version>9.3.9.v20160517</jetty.version>-->
|
||||||
|
<jetty.version>9.4.2.v20170220</jetty.version>
|
||||||
<lucene.version>4.10.4</lucene.version>
|
<lucene.version>4.10.4</lucene.version>
|
||||||
<spring.version>4.2.4.RELEASE</spring.version>
|
<spring.version>4.2.4.RELEASE</spring.version>
|
||||||
<spring.security.version>4.0.3.RELEASE</spring.security.version>
|
<spring.security.version>4.0.3.RELEASE</spring.security.version>
|
||||||
|
|
Loading…
Reference in New Issue