Clean up aaa-password-service
[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     private final String algorithmName;
14     private final String salt;
15     private final int iterations;
16     private final String hashedPassword;
17
18     private PasswordHashImpl(final String algorithmName, final String salt, final int iterations,
19                              final String hashedPassword) {
20         this.algorithmName = algorithmName;
21         this.salt = salt;
22         this.iterations = iterations;
23         this.hashedPassword = hashedPassword;
24     }
25
26     public static PasswordHash create(final String algorithmName, final String salt, final int iterations,
27                                       final String hashedPassword) {
28
29         return new PasswordHashImpl(algorithmName, salt, iterations, hashedPassword);
30     }
31
32     @Override
33     public String getAlgorithmName() {
34         return algorithmName;
35     }
36
37     @Override
38     public String getSalt() {
39         return salt;
40     }
41
42     @Override
43     public int getIterations() {
44         return iterations;
45     }
46
47     @Override
48     public String getHashedPassword() {
49         return hashedPassword;
50     }
51 }