Package org.subethamail.smtp

Examples of org.subethamail.smtp.RejectException


                } else if (response.getPayload() instanceof String) {
                    mailResponse = (MailMessageResponse) mailMessageMapper.fromXML(response.getPayload().toString());
                }

                if (mailResponse != null && mailResponse.getCode() != MailMessageResponse.OK_CODE) {
                    throw new RejectException(mailResponse.getCode(), mailResponse.getMessage());
                }
            }
        } catch (MessagingException e) {
            throw new CitrusRuntimeException(e);
        }
View Full Code Here


          addedListener = true;
        }
      }

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

        if (rec != null)
          this.deliveries.add(rec);
      }

      if (this.deliveries.isEmpty())
        throw new RejectException(553, "<" + recipient + "> address unknown.");
    }
View Full Code Here

      }
    }

    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;
      }
    }

    String username = new String(decodedSecret, 1, usernameStop - 1);
    String password = new String(decodedSecret, usernameStop + 1,
        decodedSecret.length - usernameStop - 1);
    try
    {
      helper.login(username.toString(), password);
      resetState();
    }
    catch (LoginFailedException lfe)
    {
      resetState();
      throw new RejectException();
    }
   
    ctx.setCredential(new Credential(username));
    return true;
  }
View Full Code Here

    if (username == null)
    {
      byte[] decoded = Base64.decode(clientInput);
      if (decoded == null)
      {
        throw new RejectException();
      }
      this.username = new String(decoded);
      response.append("334 ").append(Base64.encodeToString("Password:".getBytes(), false));
      return false;
    }

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

    this.password = new String(decoded);
   
    try
    {
      helper.login(username, password);
      resetState();
    }
    catch (LoginFailedException lfe)
    {
      resetState();
      throw new RejectException();
    }
   
    ctx.setCredential(new Credential(username));
    return true;
  }
View Full Code Here

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

        // 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

        // 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

        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

Related Classes of org.subethamail.smtp.RejectException

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.