DATACMNS-266 - Use new common Maven build infrastructure.

Simplified project setup to be a single module build again. Using Spring Data Build parent POM to simplify project setup. See https://github.com/SpringSource/spring-data-build#spring-data-build-infrastructure
This commit is contained in:
Oliver Gierke
2013-01-11 12:13:47 +01:00
parent c908d0e023
commit ac256f9921
375 changed files with 215 additions and 3092 deletions

View File

@@ -0,0 +1,117 @@
/*
* Copyright 2011-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.data.authentication;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
/**
* Class used to provide credentials for username/password authentication
*
* @author Thomas Risberg
* @author Oliver Gierke
*/
public class UserCredentials {
public static final UserCredentials NO_CREDENTIALS = new UserCredentials(null, null);
private final String username;
private final String password;
/**
* Creates a new {@link UserCredentials} instance from the given username and password. Empty {@link String}s provided
* will be treated like no username or password set.
*
* @param username
* @param password
*/
public UserCredentials(String username, String password) {
this.username = StringUtils.hasText(username) ? username : null;
this.password = StringUtils.hasText(password) ? password : null;
}
/**
* Get the username to use for authentication.
*
* @return the username
*/
public String getUsername() {
return username;
}
/**
* Get the password to use for authentication.
*
* @return the password
*/
public String getPassword() {
return password;
}
/**
* Returns whether the credentials contain a username.
*
* @return
*/
public boolean hasUsername() {
return this.username != null;
}
/**
* Returns whether the credentials contain a password.
*
* @return
*/
public boolean hasPassword() {
return this.password != null;
}
/*
* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (obj == null || !getClass().equals(obj.getClass())) {
return false;
}
UserCredentials that = (UserCredentials) obj;
return ObjectUtils.nullSafeEquals(this.username, that.username)
&& ObjectUtils.nullSafeEquals(this.password, that.password);
}
/*
* (non-Javadoc)
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
int result = 17;
result += 31 * ObjectUtils.nullSafeHashCode(username);
result += 31 * ObjectUtils.nullSafeHashCode(password);
return result;
}
}

View File

@@ -0,0 +1,4 @@
/**
* Types to abstract authentication concepts.
*/
package org.springframework.data.authentication;