This is an automated email from the ASF dual-hosted git repository.
rexxiong pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/celeborn.git
The following commit(s) were added to refs/heads/main by this push:
new 954bb3ca5 [CELEBORN-1521][FOLLOWUP] Using AuthenticationException
instead of SecurityException
954bb3ca5 is described below
commit 954bb3ca5a8431953db9cf9d125d2e9aab5a0f30
Author: Wang, Fei <[email protected]>
AuthorDate: Wed Oct 9 23:04:36 2024 +0800
[CELEBORN-1521][FOLLOWUP] Using AuthenticationException instead of
SecurityException
### What changes were proposed in this pull request?
As title.
### Why are the changes needed?
Have to use AuthenticationException to return status code 401 on auth
failure, otherwise, it is `500`.
https://github.com/apache/celeborn/blob/9fefa66318e5c6e0f2237f63200ade8aba367e75/service/src/main/scala/org/apache/celeborn/server/common/http/authentication/AuthenticationFilter.scala#L159-L160
### Does this PR introduce _any_ user-facing change?
No, this interface has not been released.
### How was this patch tested?
Existing GA.
Closes #2703 from turboFei/auth_exception.
Authored-by: Wang, Fei <[email protected]>
Signed-off-by: Shuang <[email protected]>
---
.../celeborn/spi/authentication/PasswdAuthenticationProvider.java | 6 ++++--
.../celeborn/spi/authentication/TokenAuthenticationProvider.java | 7 +++++--
2 files changed, 9 insertions(+), 4 deletions(-)
diff --git
a/spi/src/main/java/org/apache/celeborn/spi/authentication/PasswdAuthenticationProvider.java
b/spi/src/main/java/org/apache/celeborn/spi/authentication/PasswdAuthenticationProvider.java
index 9911d339f..7ace6d547 100644
---
a/spi/src/main/java/org/apache/celeborn/spi/authentication/PasswdAuthenticationProvider.java
+++
b/spi/src/main/java/org/apache/celeborn/spi/authentication/PasswdAuthenticationProvider.java
@@ -19,6 +19,8 @@ package org.apache.celeborn.spi.authentication;
import java.security.Principal;
+import javax.security.sasl.AuthenticationException;
+
public interface PasswdAuthenticationProvider {
/**
* The authenticate method is called by the celeborn authentication layer to
authenticate password
@@ -27,7 +29,7 @@ public interface PasswdAuthenticationProvider {
*
* @param credential The credential received over the connection request
* @return The identifier associated with the credential
- * @throws SecurityException When a user is found to be invalid by the
implementation
+ * @throws AuthenticationException When a user is found to be invalid by the
implementation
*/
- Principal authenticate(PasswordCredential credential);
+ Principal authenticate(PasswordCredential credential) throws
AuthenticationException;
}
diff --git
a/spi/src/main/java/org/apache/celeborn/spi/authentication/TokenAuthenticationProvider.java
b/spi/src/main/java/org/apache/celeborn/spi/authentication/TokenAuthenticationProvider.java
index 7daadd227..10427b798 100644
---
a/spi/src/main/java/org/apache/celeborn/spi/authentication/TokenAuthenticationProvider.java
+++
b/spi/src/main/java/org/apache/celeborn/spi/authentication/TokenAuthenticationProvider.java
@@ -19,6 +19,8 @@ package org.apache.celeborn.spi.authentication;
import java.security.Principal;
+import javax.security.sasl.AuthenticationException;
+
public interface TokenAuthenticationProvider {
/**
* The authenticate method is called by the celeborn authentication layer to
authenticate
@@ -27,7 +29,8 @@ public interface TokenAuthenticationProvider {
*
* @param credential The credential received over the connection request
* @return The identifier associated with the token
- * @throws SecurityException When the credential is found to be invalid by
the implementation
+ * @throws AuthenticationException When the credential is found to be
invalid by the
+ * implementation
*/
- Principal authenticate(TokenCredential credential);
+ Principal authenticate(TokenCredential credential) throws
AuthenticationException;
}