Package org.subethamail.smtp

Examples of org.subethamail.smtp.AuthenticationHandler


public class SmtpAuthenticated implements MailTransactionSpecification {

    @Override
    public boolean isSatisfiedBy(MailTransaction mailTransaction) {
        AuthenticationHandler authenticationHandler =
                mailTransaction.getMessageContext().getAuthenticationHandler();
        return authenticationHandler != null;
    }
View Full Code Here


    {
      sess.sendResponse("502 Authentication not supported");
      return;
    }

    AuthenticationHandler authHandler = authFactory.create();

    String[] args = this.getArgs(commandString);
    // Let's check the command syntax
    if (args.length < 2)
    {
      sess.sendResponse("501 Syntax: " + VERB + " mechanism [initial-response]");
      return;
    }

    // Let's check if we support the required authentication mechanism
    String mechanism = args[1];
    if (!authFactory.getAuthenticationMechanisms().contains(mechanism.toUpperCase(Locale.ENGLISH)))
    {
      sess.sendResponse("504 The requested authentication mechanism is not supported");
      return;
    }
    // OK, let's go trough the authentication process.
    try
    {
      // The authentication process may require a series of challenge-responses
      CRLFTerminatedReader reader = sess.getReader();

      String response = authHandler.auth(commandString);
      if (response != null)
      {
        // challenge-response iteration
        sess.sendResponse(response);
      }

      while (response != null)
      {
        String clientInput = reader.readLine();
        if (clientInput.trim().equals(AUTH_CANCEL_COMMAND))
        {
          // RFC 2554 explicitly states this:
          sess.sendResponse("501 Authentication canceled by client.");
          return;
        }
        else
        {
          response = authHandler.auth(clientInput);
          if (response != null)
          {
            // challenge-response iteration
            sess.sendResponse(response);
          }
View Full Code Here

TOP

Related Classes of org.subethamail.smtp.AuthenticationHandler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.