Skip to content

Commit

Permalink
[CELEBORN-1521][FOLLOWUP] Using AuthenticationException instead of Se…
Browse files Browse the repository at this point in the history
…curityException

### 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 apache#2703 from turboFei/auth_exception.

Authored-by: Wang, Fei <[email protected]>
Signed-off-by: Shuang <[email protected]>
  • Loading branch information
turboFei authored and RexXiong committed Oct 9, 2024
1 parent df8a9a6 commit 954bb3c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

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
Expand All @@ -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;
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

import java.security.Principal;

import javax.security.sasl.AuthenticationException;

public interface TokenAuthenticationProvider {
/**
* The authenticate method is called by the celeborn authentication layer to authenticate
Expand All @@ -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;
}

0 comments on commit 954bb3c

Please sign in to comment.