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

import jakarta.mail.Authenticator;
import jakarta.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 the username.
	 * @param password the 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);
	}
}
