Browse Source

Fix sending domain name in swift-client

This patch fixes the domain_name parameter which is sent incorrectly
when using Identity API V3 for swift authentication

Change-Id: Ide155d425216a08c1c4d23af7f7bb5496ef4edd3
Closes-Bug: #1540274
Michael Ionkin 3 years ago
parent
commit
a1e4d4ebbe

+ 3
- 4
hadoop-swiftfs/src/main/java/org/apache/hadoop/fs/swift/auth/PasswordAuthenticationRequestV3.java View File

@@ -47,7 +47,7 @@ public class PasswordAuthenticationRequestV3 extends AuthenticationRequestV3 {
47 47
   public PasswordAuthenticationRequestV3(String projectName,
48 48
                                          PasswordCredentialsV3 passwordCreds) {
49 49
       this(projectName == null ? null :
50
-           new ScopeWrapper(new ProjectWrapper(projectName)),
50
+           new ScopeWrapper(new ProjectWrapper(projectName, passwordCreds.domain)),
51 51
            passwordCreds);
52 52
   }
53 53
 
@@ -135,9 +135,8 @@ public class PasswordAuthenticationRequestV3 extends AuthenticationRequestV3 {
135 135
     private final String name;
136 136
     private final Map<String, String> domain;
137 137
 
138
-    public ProjectWrapper(String projectName) {
139
-      this.domain = new HashMap();
140
-      this.domain.put("id", "default");
138
+    public ProjectWrapper(String projectName, Map<String, String> domain) {
139
+      this.domain = domain;
141 140
       this.name = projectName;
142 141
     }
143 142
 

+ 1
- 1
hadoop-swiftfs/src/main/java/org/apache/hadoop/fs/swift/http/SwiftRestClient.java View File

@@ -515,7 +515,7 @@ public final class SwiftRestClient {
515 515
       if (trust_id == null) {
516 516
         if (password != null) {
517 517
           authRequest = new PasswordAuthenticationRequestV3(tenant,
518
-                  new PasswordCredentialsV3(username, password, null));
518
+                  new PasswordCredentialsV3(username, password, domain_name));
519 519
         } else {
520 520
           authRequest = new TokenAuthenticationRequestV3(apiKey);
521 521
         }

Loading…
Cancel
Save