Examples of RejectException


Examples of org.subethamail.smtp.RejectException

          addedListener = true;
        }
      }
     
      if (!addedListener)
        throw new RejectException(553, "<" + recipient + "> address unknown.");
    }
View Full Code Here

Examples of org.subethamail.smtp.RejectException

        // The RFC2554 "initial-response" parameter must not be present
        // The line must be in the form of "AUTH LOGIN"
        if (!stk.nextToken().trim().equalsIgnoreCase("LOGIN"))
        {
          // Mechanism mismatch
          throw new RejectException(504, "AUTH mechanism mismatch");
        }

        if (stk.hasMoreTokens())
        {
          // the client submitted an initial response
          throw new RejectException(535, "Initial response not allowed in AUTH LOGIN");
        }

        return "334 " + Base64.encodeToString(TextUtils.getAsciiBytes("Username:"), false);
      }

      if (this.username == null)
      {
        byte[] decoded = Base64.decode(clientInput);
        if (decoded == null)
        {
          throw new RejectException();
        }

        this.username = new String(decoded);

        return "334 " + Base64.encodeToString("Password:".getBytes(), false);
      }

      byte[] decoded = Base64.decode(clientInput);
      if (decoded == null)
      {
        throw new RejectException();
      }

      this.password = new String(decoded);
      try
      {
        LoginAuthenticationHandlerFactory.this.helper.login(this.username, this.password);
      }
      catch (LoginFailedException lfe)
      {
        throw new RejectException();
      }

      return null;
    }
View Full Code Here

Examples of org.subethamail.smtp.RejectException

        // Let's read the RFC2554 "initial-response" parameter
        // The line could be in the form of "AUTH PLAIN <base64Secret>"
        if (!stk.nextToken().trim().equalsIgnoreCase("PLAIN"))
        {
          // Mechanism mismatch
          throw new RejectException(504, "AUTH mechanism mismatch");
        }

        if (stk.hasMoreTokens())
        {
          // the client submitted an initial response
          secret = stk.nextToken();
        }
        else
        {
          // the client did not submit an initial response, we'll get it in the next pass
          return "334 Ok";
        }
      }

      byte[] decodedSecret = Base64.decode(secret);
      if (decodedSecret == null)
        throw new RejectException();

      int usernameStop = -1;
      for (int i = 1; (i < decodedSecret.length) && (usernameStop < 0); i++)
      {
        if (decodedSecret[i] == 0)
        {
          usernameStop = i;
        }
      }

      this.username = new String(decodedSecret, 1, usernameStop - 1);
      this.password = new String(decodedSecret, usernameStop + 1,
          decodedSecret.length - usernameStop - 1);
      try
      {
        PlainAuthenticationHandlerFactory.this.helper.login(this.username.toString(), this.password);
      }
      catch (LoginFailedException lfe)
      {
        throw new RejectException();
      }

      return null;
    }
View Full Code Here

Examples of org.subethamail.smtp.RejectException

        String method = stk.nextToken();
        AuthenticationHandlerFactory fact = MultipleAuthenticationHandlerFactory.this.plugins.get(method);

        if (fact == null)
          throw new RejectException(504, "Method not supported");

        this.active = fact.create();
      }

      return this.active.auth(clientInput);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.