Skip to content

Commit 421e11f

Browse files
committed
reset unirest config and fix AuthMethodName
1 parent 4e94c06 commit 421e11f

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

java/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
33
<modelVersion>4.0.0</modelVersion>
44
<groupId>com.kq.pulsar.client</groupId>
5-
<artifactId>SimpleClient</artifactId>
5+
<artifactId>pulsar-client-plugin</artifactId>
66
<packaging>jar</packaging>
77
<version>1.0-SNAPSHOT</version>
88
<name>SimpleClient</name>

java/src/main/java/com/kq/pulsar/client/auth/AuthenticationAuth0.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,11 @@ public void close() throws IOException {
4040

4141
@Override
4242
public String getAuthMethodName() {
43-
return "token";
43+
return "auth0";
4444
}
4545

4646
@Override
4747
public AuthenticationDataProvider getAuthData() throws PulsarClientException {
48-
// return new AuthenticationDataToken(tokenSupplier);
4948
return new AuthenticationDataAuth0(tokenSupplier);
5049
}
5150

java/src/main/java/com/kq/pulsar/client/auth/auth0/Auth0JWT.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,14 @@ public JSONObject generate() throws UnsupportedEncodingException {
6262
.body(bodyMap)
6363
.asJson();
6464

65-
System.out.println(response.getStatus());
66-
JSONObject jsonObj = response.getBody().getObject();
65+
Unirest.config().reset();
66+
int statusCode = response.getStatus();
67+
//TODO: add retry-after 503, 429, 301
68+
if (statusCode != 200) {
69+
throw new JWTVerificationException("invalide auth0.com status code " + statusCode);
70+
}
6771

72+
JSONObject jsonObj = response.getBody().getObject();
6873
return jsonObj;
6974
}
7075

0 commit comments

Comments
 (0)