8000 Update to ES 1.2.0 · nibin/elasticsearch-http-basic@2d077dc · GitHub
[go: up one dir, main page]

Skip to content

Commit 2d077dc

Browse files
committed
Update to ES 1.2.0
1 parent 909643b commit 2d077dc

File tree

3 files changed

+11
-10
lines changed

3 files changed

+11
-10
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,14 @@ There is no way to configure this on a per index basis.
1010

1111
| Http Basic Plugin | elasticsearch |
1212
|-----------------------------|-----------------------|
13-
| 1.1.0(master) | 1.0.0 |
13+
| 1.2.0(master) | 1.2.0 |
14+
| 1.1.0 | 1.0.0 |
1415
| 1.0.4 | 0.90.7 |
1516

1617
## Installation
1718

1819
Download the current version from https://github.com/Asquera/elasticsearch-http-basic/releases and copy it to `plugins/http-basic`.
19-
20+
2021
## Configuration
2122

2223
The plugin is disabled by default. Enabling basic authorization will disable the default HTTP Transport module.

pom.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44

55
<groupId>com.asquera.elasticsearch</groupId>
66
<artifactId>elasticsearch-http-basic</artifactId>
7-
<version>1.1.0</version>
7+
<version>1.2.0</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>1.0.0</elasticsearch.version>
15+
<elasticsearch.version>1.2.0</elasticsearch.version>
1616
</properties>
1717

1818
<dependencies>
@@ -71,8 +71,8 @@
7171
<groupId>org.apache.maven.plugins</groupId>
7272
<artifactId>maven-compiler-plugin</artifactId>
7373
<configuration>
74-
<source>1.6</source>
75-
<target>1.6</target>
74+
<source>1.7</source>
75+
<target>1.7</target>
7676
</configuration>
7777
</plugin>
7878
</plugins>

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import org.elasticsearch.rest.RestController;
88
import org.elasticsearch.common.inject.Inject;
99
import org.elasticsearch.common.Base64;
10-
1110
import org.elasticsearch.rest.RestRequest;
1211

1312
import static org.elasticsearch.rest.RestStatus.*;
@@ -16,9 +15,10 @@
1615
import java.util.Arrays;
1716
import java.util.HashSet;
1817
import java.util.Set;
18+
1919
import org.elasticsearch.common.logging.Loggers;
20+
import org.elasticsearch.rest.BytesRestResponse;
2021
import org.elasticsearch.rest.RestRequest.Method;
21-
import org.elasticsearch.rest.StringRestResponse;
2222

2323
// # possible http config
2424
// http.basic.user: admin
@@ -70,15 +70,15 @@ public void internalDispatchRequest(final HttpRequest request, final HttpChannel
7070

7171
// allow health check even without authorization
7272
if (healthCheck(request)) {
73-
channel.sendResponse(new StringRestResponse(OK, "{\"OK\":{}}"));
73+
channel.sendResponse(new BytesRestResponse(OK, "{\"OK\":{}}"));
7474
} else if (allowOptionsForCORS(request) || authBasic(request) || isInIPWhitelist(request)) {
7575
super.internalDispatchRequest(request, channel);
7676
} else {
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));
8080

81-
StringRestResponse response = new StringRestResponse(UNAUTHORIZED, "Authentication Required");
81+
BytesRestResponse response = new BytesRestResponse(UNAUTHORIZED, "Authentication Required");
8282
response.addHeader("WWW-Authenticate", "Basic realm=\"Restricted\"");
8383
channel.sendResponse(response);
8484
}

0 commit comments

Comments
 (0)
0