FileDocCategorySizeDatePackage
SMTPAuthUserIs.javaAPI DocApache James 2.3.12757Fri Jan 12 12:56:32 GMT 2007org.apache.james.transport.matchers

SMTPAuthUserIs

public class SMTPAuthUserIs extends org.apache.mailet.GenericMatcher

Matches mails that are sent by an SMTP authenticated user present in a supplied list.

If the sender was not authenticated it will not match.

Configuration string: a comma, tab or space separated list of James users.


<mailet match="SMTPAuthUserIs=<list-of-user-names>" class="<any-class>">
version
CVS $Revision: 494012 $ $Date: 2007-01-08 11:23:58 +0100 (Mo, 08 Jan 2007) $
since
2.2.0

Fields Summary
private static final String
SMTP_AUTH_USER_ATTRIBUTE_NAME
The mail attribute holding the SMTP AUTH user name, if any.
private Collection
users
Constructors Summary
Methods Summary
public voidinit()


         
        StringTokenizer st = new StringTokenizer(getCondition(), ", \t", false);
        users = new java.util.HashSet();
        while (st.hasMoreTokens()) {
            users.add(st.nextToken());
        }
    
public java.util.Collectionmatch(org.apache.mailet.Mail mail)

        String authUser = (String) mail.getAttribute(SMTP_AUTH_USER_ATTRIBUTE_NAME);
        if (authUser != null && users.contains(authUser)) {
            return mail.getRecipients();
        } else {
            return null;
        }