All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.dihedron.core.Credentials Maven / Gradle / Ivy

Go to download

Base set of functionalities, including simple utility classes and more complex patterns.

The newest version!
/*
 * Copyright (c) 2012-2015, Andrea Funto'. All rights reserved. See LICENSE for details.
 */ 
package org.dihedron.core;


/**
 * @author Andrea Funto'
 */
@License
public class Credentials {
	
	public static final String NO_PASSWORD = "********";
			
	/**
	 * The username to use for authentication.
	 */
	private String username;
	
	/**
	 * The password to use for authentication.
	 */
	private String password = NO_PASSWORD;
	
	/**
	 * The domain to use for authentication.
	 */
	private String domain;
	
	/**
	 * The method to use for authentication.
	 */
	private String method;

	/**
	 * @return the username
	 */
	public String getUsername() {
		return username;
	}

	/**
	 * @param username the username to set
	 */
	public Credentials setUsername(String username) {
		this.username = username;
		return this;
	}

	/**
	 * @return the password
	 */
	public String getPassword() {
		return password;
	}

	/**
	 * @param password the password to set
	 */
	public Credentials setPassword(String password) {
		this.password = password;
		if(password.equals(NO_PASSWORD)) {
			throw new IllegalArgumentException("You must set the password before proceeding!!!");
		}
		return this;
	}

	/**
	 * @return the domain
	 */
	public String getDomain() {
		return domain;
	}

	/**
	 * Sets the new value of the authentication domain.
	 * 
	 * @param domain
	 *   the value of the authentication method.
	 * @return
	 *   the object itself, for method chaining.
	 */
	public Credentials setDomain(String domain) {
		this.domain = domain;
		return this;
	}

	/**
	 * Returns the value of the authentication method.
	 * 
	 * @return 
	 *   the value of the authentication method.
	 */
	public String getMethod() {
		return method;
	}

	/**
	 * Sets the new value of the authentication method.
	 * 
	 * @param method 
	 *   the new value of the authentication method.
	 * @return
	 *   the object itself, for method chaining.
	 */
	public Credentials setMethod(String method) {
		this.method = method;
		return this;
	}	
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy