06faad0d4b182552f3bc45178fe9bf4afc7c5e00
[aaa.git] / aaa-password-service / impl / src / main / java / org / opendaylight / aaa / impl / password / service / PasswordHashImpl.java
1 /*
2  * Copyright © 2018 Inocybe Technologies and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.aaa.impl.password.service;
9
10 import org.opendaylight.aaa.api.password.service.PasswordHash;
11
12 public final class PasswordHashImpl implements PasswordHash {
13
14     private final String algorithmName;
15     private final String salt;
16     private final int iterations;
17     private final String hashedPassword;
18
19     private PasswordHashImpl(final String algorithmName, final String salt, final int iterations,
20                              final String hashedPassword) {
21
22         this.algorithmName = algorithmName;
23         this.salt = salt;
24         this.iterations = iterations;
25         this.hashedPassword = hashedPassword;
26     }
27
28     public static PasswordHash create(final String algorithmName, final String salt, final int iterations,
29                                       final String hashedPassword) {
30
31         return new PasswordHashImpl(algorithmName, salt, iterations, hashedPassword);
32     }
33
34     public String getAlgorithmName() {
35         return this.algorithmName;
36     }
37
38     public String getSalt() {
39         return this.salt;
40     }
41
42     public int getIterations() {
43         return this.iterations;
44     }
45
46     public String getHashedPassword() {
47         return this.hashedPassword;
48     }
49 }