You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tika.apache.org by nd...@apache.org on 2024/04/12 19:52:43 UTC

(tika) branch tika-grpc-3x-features updated (0026fa286 -> ad41c94dc)

This is an automated email from the ASF dual-hosted git repository.

ndipiazza pushed a change to branch tika-grpc-3x-features
in repository https://gitbox.apache.org/repos/asf/tika.git


    from 0026fa286 Merge branch 'TIKA-4237-Add-JWT-authentication-ability-to-the-http-fetcher' into local-feature
     new d2e559078 jwt config
     new ad41c94dc remaining merges to get code up to date

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 tika-pipes/tika-fetchers/tika-fetcher-http/pom.xml |  2 +-
 .../tika/pipes/fetcher/http/HttpFetcher.java       |  6 +++
 .../fetcher/http/config/HttpFetcherConfig.java     | 51 ++++++++++++++++++++++
 .../tika/pipes/fetcher/http/jwt/JwtCreds.java      | 16 +++++++
 .../tika/pipes/fetcher/http/jwt/JwtGenerator.java  | 16 +++++++
 .../pipes/fetcher/http/jwt/JwtPrivateKeyCreds.java | 16 +++++++
 .../pipes/fetcher/http/jwt/JwtSecretCreds.java     | 16 +++++++
 .../pipes/fetcher/http/jwt/JwtGeneratorTest.java   | 16 +++++++
 8 files changed, 138 insertions(+), 1 deletion(-)


(tika) 02/02: remaining merges to get code up to date

Posted by nd...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ndipiazza pushed a commit to branch tika-grpc-3x-features
in repository https://gitbox.apache.org/repos/asf/tika.git

commit ad41c94dcdfc7c9c6fbfc9d677db46e25486b814
Author: Nicholas DiPiazza <nd...@apache.org>
AuthorDate: Fri Apr 12 14:52:34 2024 -0500

    remaining merges to get code up to date
---
 .../org/apache/tika/pipes/fetcher/http/jwt/JwtCreds.java | 16 ++++++++++++++++
 .../apache/tika/pipes/fetcher/http/jwt/JwtGenerator.java | 16 ++++++++++++++++
 .../tika/pipes/fetcher/http/jwt/JwtPrivateKeyCreds.java  | 16 ++++++++++++++++
 .../tika/pipes/fetcher/http/jwt/JwtSecretCreds.java      | 16 ++++++++++++++++
 .../tika/pipes/fetcher/http/jwt/JwtGeneratorTest.java    | 16 ++++++++++++++++
 5 files changed, 80 insertions(+)

diff --git a/tika-pipes/tika-fetchers/tika-fetcher-http/src/main/java/org/apache/tika/pipes/fetcher/http/jwt/JwtCreds.java b/tika-pipes/tika-fetchers/tika-fetcher-http/src/main/java/org/apache/tika/pipes/fetcher/http/jwt/JwtCreds.java
index 6ff445dfc..ed783e733 100644
--- a/tika-pipes/tika-fetchers/tika-fetcher-http/src/main/java/org/apache/tika/pipes/fetcher/http/jwt/JwtCreds.java
+++ b/tika-pipes/tika-fetchers/tika-fetcher-http/src/main/java/org/apache/tika/pipes/fetcher/http/jwt/JwtCreds.java
@@ -1,3 +1,19 @@
+/*
+ * 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.
+ */
 package org.apache.tika.pipes.fetcher.http.jwt;
 
 public abstract class JwtCreds {
diff --git a/tika-pipes/tika-fetchers/tika-fetcher-http/src/main/java/org/apache/tika/pipes/fetcher/http/jwt/JwtGenerator.java b/tika-pipes/tika-fetchers/tika-fetcher-http/src/main/java/org/apache/tika/pipes/fetcher/http/jwt/JwtGenerator.java
index 4ab4b8214..c8e7bdf2b 100644
--- a/tika-pipes/tika-fetchers/tika-fetcher-http/src/main/java/org/apache/tika/pipes/fetcher/http/jwt/JwtGenerator.java
+++ b/tika-pipes/tika-fetchers/tika-fetcher-http/src/main/java/org/apache/tika/pipes/fetcher/http/jwt/JwtGenerator.java
@@ -1,3 +1,19 @@
+/*
+ * 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.
+ */
 package org.apache.tika.pipes.fetcher.http.jwt;
 
 import java.time.Instant;
diff --git a/tika-pipes/tika-fetchers/tika-fetcher-http/src/main/java/org/apache/tika/pipes/fetcher/http/jwt/JwtPrivateKeyCreds.java b/tika-pipes/tika-fetchers/tika-fetcher-http/src/main/java/org/apache/tika/pipes/fetcher/http/jwt/JwtPrivateKeyCreds.java
index aac7f155d..149e74f5a 100644
--- a/tika-pipes/tika-fetchers/tika-fetcher-http/src/main/java/org/apache/tika/pipes/fetcher/http/jwt/JwtPrivateKeyCreds.java
+++ b/tika-pipes/tika-fetchers/tika-fetcher-http/src/main/java/org/apache/tika/pipes/fetcher/http/jwt/JwtPrivateKeyCreds.java
@@ -1,3 +1,19 @@
+/*
+ * 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.
+ */
 package org.apache.tika.pipes.fetcher.http.jwt;
 
 import java.security.KeyFactory;
diff --git a/tika-pipes/tika-fetchers/tika-fetcher-http/src/main/java/org/apache/tika/pipes/fetcher/http/jwt/JwtSecretCreds.java b/tika-pipes/tika-fetchers/tika-fetcher-http/src/main/java/org/apache/tika/pipes/fetcher/http/jwt/JwtSecretCreds.java
index a8c121b23..f159cce3a 100644
--- a/tika-pipes/tika-fetchers/tika-fetcher-http/src/main/java/org/apache/tika/pipes/fetcher/http/jwt/JwtSecretCreds.java
+++ b/tika-pipes/tika-fetchers/tika-fetcher-http/src/main/java/org/apache/tika/pipes/fetcher/http/jwt/JwtSecretCreds.java
@@ -1,3 +1,19 @@
+/*
+ * 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.
+ */
 package org.apache.tika.pipes.fetcher.http.jwt;
 
 public class JwtSecretCreds extends JwtCreds {
diff --git a/tika-pipes/tika-fetchers/tika-fetcher-http/src/test/java/org/apache/tika/pipes/fetcher/http/jwt/JwtGeneratorTest.java b/tika-pipes/tika-fetchers/tika-fetcher-http/src/test/java/org/apache/tika/pipes/fetcher/http/jwt/JwtGeneratorTest.java
index 0e2769d99..62aa082ad 100644
--- a/tika-pipes/tika-fetchers/tika-fetcher-http/src/test/java/org/apache/tika/pipes/fetcher/http/jwt/JwtGeneratorTest.java
+++ b/tika-pipes/tika-fetchers/tika-fetcher-http/src/test/java/org/apache/tika/pipes/fetcher/http/jwt/JwtGeneratorTest.java
@@ -1,3 +1,19 @@
+/*
+ * 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.
+ */
 package org.apache.tika.pipes.fetcher.http.jwt;
 
 import java.security.KeyPair;


(tika) 01/02: jwt config

Posted by nd...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ndipiazza pushed a commit to branch tika-grpc-3x-features
in repository https://gitbox.apache.org/repos/asf/tika.git

commit d2e5590781adb4d7eb8c726daedcebc12b4d7046
Author: Nicholas DiPiazza <nd...@apache.org>
AuthorDate: Wed Apr 10 17:21:03 2024 -0500

    jwt config
---
 tika-pipes/tika-fetchers/tika-fetcher-http/pom.xml |  2 +-
 .../tika/pipes/fetcher/http/HttpFetcher.java       |  6 +++
 .../fetcher/http/config/HttpFetcherConfig.java     | 51 ++++++++++++++++++++++
 3 files changed, 58 insertions(+), 1 deletion(-)

diff --git a/tika-pipes/tika-fetchers/tika-fetcher-http/pom.xml b/tika-pipes/tika-fetchers/tika-fetcher-http/pom.xml
index 5f664108c..c204370d1 100644
--- a/tika-pipes/tika-fetchers/tika-fetcher-http/pom.xml
+++ b/tika-pipes/tika-fetchers/tika-fetcher-http/pom.xml
@@ -48,7 +48,7 @@
     <dependency>
       <groupId>com.nimbusds</groupId>
       <artifactId>nimbus-jose-jwt</artifactId>
-      <version>9.5</version>
+      <version>9.37.3</version>
     </dependency>
     <dependency>
       <groupId>${project.groupId}</groupId>
diff --git a/tika-pipes/tika-fetchers/tika-fetcher-http/src/main/java/org/apache/tika/pipes/fetcher/http/HttpFetcher.java b/tika-pipes/tika-fetchers/tika-fetcher-http/src/main/java/org/apache/tika/pipes/fetcher/http/HttpFetcher.java
index eb4d9215c..fa035e76f 100644
--- a/tika-pipes/tika-fetchers/tika-fetcher-http/src/main/java/org/apache/tika/pipes/fetcher/http/HttpFetcher.java
+++ b/tika-pipes/tika-fetchers/tika-fetcher-http/src/main/java/org/apache/tika/pipes/fetcher/http/HttpFetcher.java
@@ -106,6 +106,12 @@ public class HttpFetcher extends AbstractFetcher implements Initializable, Range
 
         setProxyHost(httpFetcherConfig.getProxyHost());
         setProxyPort(httpFetcherConfig.getProxyPort());
+
+        setJwtIssuer(httpFetcherConfig.getJwtIssuer());
+        setJwtExpiresInSeconds(httpFetcherConfig.getJwtExpiresInSeconds());
+        setJwtSecret(httpFetcherConfig.getJwtIssuer());
+        setJwtPrivateKeyBase64(httpFetcherConfig.getJwtPrivateKeyBase64());
+        setJwtSubject(httpFetcherConfig.getJwtSubject());
     }
     public static String HTTP_HEADER_PREFIX = "http-header:";
 
diff --git a/tika-pipes/tika-fetchers/tika-fetcher-http/src/main/java/org/apache/tika/pipes/fetcher/http/config/HttpFetcherConfig.java b/tika-pipes/tika-fetchers/tika-fetcher-http/src/main/java/org/apache/tika/pipes/fetcher/http/config/HttpFetcherConfig.java
index 2683e7f55..a5bed636b 100644
--- a/tika-pipes/tika-fetchers/tika-fetcher-http/src/main/java/org/apache/tika/pipes/fetcher/http/config/HttpFetcherConfig.java
+++ b/tika-pipes/tika-fetchers/tika-fetcher-http/src/main/java/org/apache/tika/pipes/fetcher/http/config/HttpFetcherConfig.java
@@ -38,6 +38,12 @@ public class HttpFetcherConfig extends AbstractConfig {
     private long overallTimeout;
     private int maxErrMsgSize;
     private String userAgent;
+    private String jwtIssuer;
+    private String jwtSubject;
+    private int jwtExpiresInSeconds;
+    private String jwtSecret;
+    private String jwtPrivateKeyBase64;
+
 
     public String getUserName() {
         return userName;
@@ -191,4 +197,49 @@ public class HttpFetcherConfig extends AbstractConfig {
         this.userAgent = userAgent;
         return this;
     }
+
+    public String getJwtIssuer() {
+        return jwtIssuer;
+    }
+
+    public HttpFetcherConfig setJwtIssuer(String jwtIssuer) {
+        this.jwtIssuer = jwtIssuer;
+        return this;
+    }
+
+    public String getJwtSubject() {
+        return jwtSubject;
+    }
+
+    public HttpFetcherConfig setJwtSubject(String jwtSubject) {
+        this.jwtSubject = jwtSubject;
+        return this;
+    }
+
+    public int getJwtExpiresInSeconds() {
+        return jwtExpiresInSeconds;
+    }
+
+    public HttpFetcherConfig setJwtExpiresInSeconds(int jwtExpiresInSeconds) {
+        this.jwtExpiresInSeconds = jwtExpiresInSeconds;
+        return this;
+    }
+
+    public String getJwtSecret() {
+        return jwtSecret;
+    }
+
+    public HttpFetcherConfig setJwtSecret(String jwtSecret) {
+        this.jwtSecret = jwtSecret;
+        return this;
+    }
+
+    public String getJwtPrivateKeyBase64() {
+        return jwtPrivateKeyBase64;
+    }
+
+    public HttpFetcherConfig setJwtPrivateKeyBase64(String jwtPrivateKeyBase64) {
+        this.jwtPrivateKeyBase64 = jwtPrivateKeyBase64;
+        return this;
+    }
 }