8000 Merge pull request #7 from andreadelfino/master · ekhoinc/elasticsearch-http-basic@cc4fc60 · GitHub
[go: up one dir, main page]

Skip to content

Commit cc4fc60

Browse files
author
Peter
committed
Merge pull request Asquera#7 from andreadelfino/master
Updated to Elasticsearch 0.90.7, added basic support for WWW-Authenticate
2 parents 8aa6abb + 7f27641 commit cc4fc60

File tree

4 files changed

+15
-10
lines changed

4 files changed

+15
-10
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
*.class
22
*.jar
33
*.zip
4+
/build/
45
/target/
56
*~
67
deploy.sh
8+
.gradle

build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
apply plugin: 'java'
22

3-
version = '1.0.3'
3+
version = '1.0.3.1'
44

55
sourceSets.main.resources.srcDirs 'src/main/java'
66
sourceSets.test.resources.srcDirs 'src/test/java'
@@ -10,8 +10,8 @@ configurations {
1010
}
1111

1212
if (hasProperty("xlint")) {
13-
tasks.withType(Compile) {
14-
options.compilerArgs << "-Xlint:unchecked"
13+
tasks.withType(Compile) {
14+
options.compilerArgs << "-Xlint:unchecked"
1515
}
1616
}
1717

@@ -28,5 +28,5 @@ repositories {
2828
}
2929

3030
dependencies {
31-
compile group: "org.elasticsearch", name: 'elasticsearch', version: "0.18.5"
31+
compile group: "org.elasticsearch", name: 'elasticsearch', version: "0.90.7"
3232
}

pom.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
<modelVersion>4.0.0</modelVersion>
44

55
<groupId>com.asquera.elasticsearch</groupId>
6-
<artifactId>http-basic</artifactId>
7-
<version>0.90.0-SNAPSHOT</version>
6+
<artifactId>elasticsearch-http-basic</artifactId>
7+
<version>1.0.3.1</version>
88
<packaging>jar</packaging>
99

1010
<name>Basic Authentication Plugin</name>
1111
<url>http://maven.apache.org</url>
1212

1313
<properties>
1414
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
15-
<elasticsearch.version>0.90.0</elasticsearch.version>
15+
<elasticsearch.version>0.90.7</elasticsearch.version>
1616
</properties>
1717

1818
<dependencies>
@@ -21,7 +21,7 @@
2121
<artifactId>elasticsearch</artifactId>
2222
<version>${elasticsearch.version}</version>
2323
</dependency>
24-
24+
2525
<dependency>
2626
<groupId>org.testng</groupId>
2727
<artifactId>testng</artifactId>
@@ -54,7 +54,7 @@
5454
<target>
5555
<zip basedir="${project.build.directory}"
5656
includes="${project.build.finalName}.jar"
57-
destfile="${project.build.directory}/elasticsearch-${project.artifactId}-${elasticsearch.version}.zip" />
57+
destfile="${project.build.directory}/${project.artifactId}-${project.version}.zip" />
5858
</target>
5959
</configuration>
6060
<goals>

src/main/java/com/asquera/elasticsearch/plugins/http/HttpBasicServer.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,10 @@ public void internalDispatchRequest(final HttpRequest request, final HttpChannel
7777
String addr = getAddress(request);
7878
Loggers.getLogger(getClass()).error("UNAUTHORIZED type:{}, address:{}, path:{}, request:{}, content:{}, credentials:{}",
7979
request.method(), addr, request.path(), request.params(), request.content().toUtf8(), getDecoded(request));
80-
channel.sendResponse(new StringRestResponse(UNAUTHORIZED, "Authentication Required"));
80+
81+
StringRestResponse response = new StringRestResponse(UNAUTHORIZED, "Authentication Required");
82+
response.addHeader("WWW-Authenticate", "Basic realm=\"Restricted\"");
83+
channel.sendResponse(response);
8184
}
8285
}
8386

0 commit comments

Comments
 (0)
0