270d004c67e6f8dbf76e5cb5b7f6a78b03e03383
[vfc/nfvo/driver/vnfm/svnfm.git] /
1 /*
2  * Copyright 2016-2017, Nokia Corporation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.onap.core;
17
18 import static com.google.common.hash.Hashing.sha512;
19
20 /**
21  * Describes the VNFM credentials
22  */
23 public class VnfmCredentials {
24     private final String username;
25     private final String password;
26     private final String clientId;
27     private final String clientSecret;
28
29     /**
30      * @param username     the username for the VNFM
31      * @param password     the password for the VNFM
32      * @param clientId     the client identifier
33      * @param clientSecret the client secret
34      */
35     VnfmCredentials(String username, String password, String clientId, String clientSecret) {
36         this.username = username;
37         this.password = password;
38         this.clientId = clientId;
39         this.clientSecret = clientSecret;
40     }
41
42     /**
43      * @return the username for the VNFM
44      */
45     public String getUsername() {
46         return username;
47     }
48
49     /**
50      * @return the password for the VNFM
51      */
52     public String getPassword() {
53         return password;
54     }
55
56     /**
57      * @return the client identifier
58      */
59     public String getClientId() {
60         return clientId;
61     }
62
63     /**
64      * @return the client secret
65      */
66     public String getClientSecret() {
67         return clientSecret;
68     }
69
70     @Override
71     public String toString() {
72         return "VnfmCredentials{" +
73                 "username='" + username + '\'' +
74                 ", password='" + sha512().hashBytes(password.getBytes()).toString() + '\'' +
75                 ", clientId='" + clientId + '\'' +
76                 ", clientSecret='" + sha512().hashBytes(clientSecret.getBytes()).toString() + '\'' +
77                 '}';
78     }
79 }