/**
 * 
 */
package it.mice.voila.runtime.mail.senders;

import javax.mail.Authenticator;
import javax.mail.PasswordAuthentication;

/**
 * Mail Authenticator used for mail engine security based on SPA SSL access.
 */
public class MailAuthenticator extends Authenticator {
	/**
	 * The username.
	 */
	private String username;
	/**
	 * The password.
	 */
	private String password;
	
	/**
	 * Default constructor.
	 * @param username
	 * @param password
	 */
	public MailAuthenticator(String username, String password) {
		super();
		this.username = username;
		this.password = password;
	}

	/** {@inheritDoc}
	 * @see javax.mail.Authenticator#getPasswordAuthentication()
	 */
	@Override
	protected PasswordAuthentication getPasswordAuthentication() {
		return new PasswordAuthentication(username, password);
	}
}
