pan3793 commented on code in PR #2604:
URL: https://github.com/apache/celeborn/pull/2604#discussion_r1666987866
##########
service/src/main/scala/org/apache/celeborn/server/common/http/HttpAuthUtils.scala:
##########
@@ -17,9 +17,19 @@
package org.apache.celeborn.server.common.http
+import org.apache.celeborn.common.authentication.Credential
+import
org.apache.celeborn.server.common.http.authentication.AuthenticationFilter
+
object HttpAuthUtils {
// HTTP header used by the server endpoint during an authentication sequence.
val WWW_AUTHENTICATE_HEADER = "WWW-Authenticate"
// HTTP header used by the client endpoint during an authentication sequence.
val AUTHORIZATION_HEADER = "Authorization"
+
+ def getCredentialExtraInfo: Map[String, String] = {
+ Map(Credential.CLIENT_IP_PROPERTY ->
Review Comment:
```suggestion
Map(Credential.CLIENT_IP_KEY ->
```
##########
service/src/test/scala/org/apache/celeborn/server/common/http/authentication/UserDefineTokenAuthenticationProviderImpl.scala:
##########
@@ -20,14 +20,16 @@ package
org.apache.celeborn.server.common.http.authentication
import java.security.Principal
import javax.security.sasl.AuthenticationException
-import org.apache.celeborn.common.authentication.{BasicPrincipal,
TokenAuthenticationProvider}
+import org.apache.celeborn.common.authentication.{BasicPrincipal, Credential,
TokenAuthenticationProvider, TokenCredential}
import org.apache.celeborn.common.internal.Logging
import
org.apache.celeborn.server.common.http.authentication.UserDefineTokenAuthenticationProviderImpl.VALID_TOKEN
class UserDefineTokenAuthenticationProviderImpl extends
TokenAuthenticationProvider with Logging {
- override def authenticate(token: String): Principal = {
- if (token == VALID_TOKEN) {
- logInfo(s"Success log in of token: $token")
+ override def authenticate(credential: TokenCredential): Principal = {
+ val clientIp =
+ credential.extraInfo.getOrElse(Credential.CLIENT_IP_PROPERTY, null)
Review Comment:
```suggestion
credential.extraInfo.getOrElse(Credential.CLIENT_IP_KEY, null)
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]