updates for keystone V3 auth
[so.git] / adapters / mso-adapter-utils / src / main / java / org / onap / so / cloud / authentication / AuthenticationMethodFactory.java
index 59c6bec..fa5c57f 100644 (file)
@@ -89,4 +89,23 @@ public final class AuthenticationMethodFactory {
         v3Auth.setScope(scope);
         return v3Auth;
     }
+
+    public final com.woorea.openstack.keystone.v3.model.Authentication getAuthenticationForV3(
+            CloudIdentity cloudIdentity) {
+        Identity identity = new Identity();
+        Password password = new Password();
+        User user = new User();
+        Domain userDomain = new Domain();
+        userDomain.setName(cloudIdentity.getUserDomainName());
+        user.setName(cloudIdentity.getMsoId());
+        user.setPassword(CryptoUtils.decryptCloudConfigPassword(cloudIdentity.getMsoPass()));
+        user.setDomain(userDomain);
+        password.setUser(user);
+        identity.setPassword(password);
+        identity.setMethods(Collections.singletonList("password"));
+        com.woorea.openstack.keystone.v3.model.Authentication v3Auth =
+                new com.woorea.openstack.keystone.v3.model.Authentication();
+        v3Auth.setIdentity(identity);
+        return v3Auth;
+    }
 }