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

org.subethamail.smtp.AuthenticationHandler Maven / Gradle / Ivy

package org.subethamail.smtp;

import java.util.List;

import org.subethamail.smtp.server.ConnectionContext;

/**
 * The interface that enables challenge-response communication necessary for SMTP AUTH.

* Since the authentication process can be stateful, an instance of this class can be stateful too.
* Do not share a single instance of this interface if you don't explicitly need to do so. * * @author Marco Trevisan */ public interface AuthenticationHandler { /** * If your handler supports RFC 2554 at some degree, then it must return all the supported mechanisms here.
* The order you use to populate the list will be preserved in the output of the EHLO command.
* If your handler does not support RFC 2554 at all, return an empty list. * * @return the supported authentication mechanisms as List. */ public List getAuthenticationMechanisms(); /** * Initially called using an input string in the RFC2554 form: "AUTH [initial-response]".
* This method must provide the correct reply (by filling the response parameter) at each clientInput. *

* Depending on the authentication mechanism, the handshaking process may require * many request-response passes. This method will return true only when the authentication process is finished
* * @return true if the authentication process is finished, false otherwise. * @param clientInput The client's input. * @param response a buffer filled with your response to the client input. * @param ctx the connection context filled with the credential of the user if authentication succeeds. * @throws org.subethamail.smtp.RejectException if authentication fails. */ public boolean auth(String clientInput, StringBuilder response, ConnectionContext ctx) throws RejectException; /** * Since a so-designed handler has its own state, it seems reasonable to enable resetting * its state. This can be done, for example, after a "*" client response during the AUTH command * processing. */ public void resetState(); }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy