5cf5587481861bb3e75ad4535583dec0d89723a1
[so.git] /
1 /*\r
2  * ============LICENSE_START==========================================\r
3  * ===================================================================\r
4  * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.\r
5  * ===================================================================\r
6  * Licensed under the Apache License, Version 2.0 (the "License");\r
7  * you may not use this file except in compliance with the License.\r
8  * You may obtain a copy of the License at\r
9  *\r
10  *        http://www.apache.org/licenses/LICENSE-2.0\r
11  *\r
12  * Unless required by applicable law or agreed to in writing, software\r
13  * distributed under the License is distributed on an "AS IS" BASIS,\r
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
15  * See the License for the specific language governing permissions and\r
16  * limitations under the License.\r
17  * ============LICENSE_END============================================\r
18  *\r
19  * ECOMP and OpenECOMP are trademarks\r
20  * and service marks of AT&T Intellectual Property.\r
21  *\r
22  */\r
23 \r
24 package org.openecomp.mso.cloud.authentication.wrappers;\r
25 \r
26 import org.openecomp.mso.cloud.CloudIdentity;\r
27 import org.openecomp.mso.cloud.authentication.AuthenticationWrapper;\r
28 import org.openecomp.mso.cloud.authentication.models.RackspaceAuthentication;\r
29 \r
30 import com.woorea.openstack.keystone.model.Authentication;\r
31 \r
32 /**\r
33  * This class implements the authentication wrapper for Rackspace Authentication.\r
34  *\r
35  */\r
36 public class RackspaceAPIKeyWrapper extends AuthenticationWrapper {\r
37 \r
38         /**\r
39          * \r
40          */\r
41         public RackspaceAPIKeyWrapper() {\r
42                 // TODO Auto-generated constructor stub\r
43         }\r
44 \r
45         /* (non-Javadoc)\r
46          * @see org.openecomp.mso.cloud.authentication.AuthenticationWrapper#getAuthentication(org.openecomp.mso.cloud.CloudIdentity)\r
47          */\r
48         @Override\r
49         public Authentication getAuthentication(CloudIdentity cloudIdentity) {\r
50                 if (cloudIdentity == null) {\r
51                         throw new IllegalArgumentException("Provided cloud identity is null, cannot extract username and password");\r
52                 }\r
53                 return new RackspaceAuthentication (cloudIdentity.getMsoId (), cloudIdentity.getMsoPass ());\r
54         }\r
55 }\r