2 * Copyright (c) 2014, 2017 Hewlett-Packard Development Company, L.P. and others. All rights reserved.
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
8 package org.opendaylight.aaa.tokenauthrealm.auth;
10 import java.util.Objects;
11 import org.opendaylight.aaa.api.PasswordCredentials;
14 * {@link PasswordCredentials} builder.
18 public class PasswordCredentialBuilder {
19 private final MutablePasswordCredentials pc = new MutablePasswordCredentials();
21 public PasswordCredentialBuilder setUserName(final String username) {
22 pc.username = username;
26 public PasswordCredentialBuilder setPassword(final String password) {
27 pc.password = password;
31 public PasswordCredentialBuilder setDomain(final String domain) {
36 public PasswordCredentials build() {
40 private static class MutablePasswordCredentials implements PasswordCredentials {
41 private int hashCode = 0;
42 private String username;
43 private String password;
44 private String domain;
47 public String username() {
52 public String password() {
57 public String domain() {
62 public boolean equals(final Object obj) {
63 return this == obj || obj instanceof PasswordCredentials other
64 && Objects.equals(username, other.username())
65 && Objects.equals(password, other.password())
66 && Objects.equals(domain, other.domain());
70 public int hashCode() {
72 hashCode = Objects.hash(username, password, domain);