@Override
public boolean equals(Object o) {
- if (this == o)
+ if (this == o) {
return true;
- if (!(o instanceof Authentication))
+ }
+ if (!(o instanceof Authentication)) {
return false;
+ }
Authentication a = (Authentication) o;
return areEqual(expiration, a.expiration()) && super.equals(o);
}
@Override
public String toString() {
StringBuffer sb = new StringBuffer();
- if (clientId != null)
+ if (clientId != null) {
sb.append("clientId:").append(clientId).append(",");
- if (userId != null)
+ }
+ if (userId != null) {
sb.append("userId:").append(userId).append(",");
- if (user != null)
+ }
+ if (user != null) {
sb.append("userName:").append(user).append(",");
- if (domain != null)
+ }
+ if (domain != null) {
sb.append("domain:").append(domain).append(",");
+ }
sb.append("roles:").append(roles);
return sb.toString();
}
public void validate(String clientId, String clientSecret)
throws AuthenticationException {
// TODO: Post-Helium, we will support a CRUD API
- if (!clients.containsKey(clientId))
+ if (!clients.containsKey(clientId)) {
throw new AuthenticationException(UNAUTHORIZED_CLIENT_ERR);
- if (!clients.get(clientId).equals(clientSecret))
+ }
+ if (!clients.get(clientId).equals(clientSecret)) {
throw new AuthenticationException(UNAUTHORIZED_CLIENT_ERR);
+ }
}
@Override
public void updated(Dictionary<String, ?> props)
throws ConfigurationException {
- if (props == null)
+ if (props == null) {
props = defaults;
+ }
reconfig(props);
}
+/*****************************************************************************
+ * Copyright (c) 2014 Hewlett-Packard Development Company, L.P. and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *****************************************************************************/
package org.opendaylight.aaa;
import java.lang.reflect.Array;
Object item = Array.get(aObject, idx);
// if an item in the array references the array itself, prevent
// infinite looping
- if (!(item == aObject))
+ if (!(item == aObject)) {
result = hash(result, item);
+ }
}
}
return result;
/**
* {@link PasswordCredentials} builder.
- *
+ *
* @author liemmn
- *
+ *
*/
public class PasswordCredentialBuilder {
private final MutablePasswordCredentials pc = new MutablePasswordCredentials();
pc.password = password;
return this;
}
-
+
public PasswordCredentials build() {
return pc;
}
@Override
public boolean equals(Object o) {
- if (this == o)
+ if (this == o) {
return true;
- if (!(o instanceof PasswordCredentials))
+ }
+ if (!(o instanceof PasswordCredentials)) {
return false;
+ }
PasswordCredentials p = (PasswordCredentials) o;
return areEqual(username, p.username())
&& areEqual(password, p.password());
Iterator<SecureData<T>> it = queue.iterator();
while (it.hasNext()) {
SecureData<T> sd = it.next();
- if (sd.data.equals(o))
+ if (sd.data.equals(o)) {
return queue.remove(sd);
+ }
}
return false;
}
Iterator<SecureData<T>> it = queue.iterator();
while (it.hasNext()) {
SecureData<T> sd = it.next();
- if (sd.data.equals(o))
+ if (sd.data.equals(o)) {
return true;
+ }
}
return false;
}
@SuppressWarnings("unchecked")
private Collection<SecureData<T>> fromData(Collection<?> c) {
Collection<SecureData<T>> sd = new ArrayList<>(c.size());
- for (Object d : c)
+ for (Object d : c) {
sd.add((SecureData<T>) new SecureData<>(d));
+ }
return sd;
}
private Collection<T> toData(Collection<SecureData<T>> secureData) {
Collection<T> data = new ArrayList<>(secureData.size());
Iterator<SecureData<T>> it = secureData.iterator();
- while (it.hasNext())
+ while (it.hasNext()) {
data.add(it.next().data);
+ }
return data;
}
@SuppressWarnings("rawtypes")
@Override
public boolean equals(Object o) {
- if (o == null) return false;
+ if (o == null) {
+ return false;
+ }
return (o instanceof SecureData)
? data.equals(((SecureData) o).data): false;
}