Search in sources :

Example 1 with Authenticator

use of org.apache.james.mailbox.store.Authenticator in project i2p.i2p-bote by i2p.

the class ImapService method create.

public static ImapService create(Configuration configuration, final PasswordVerifier passwordVerifier, EmailFolderManager folderManager) throws ConfigurationException {
    MapperFactory mailboxSessionMapperFactory = new MapperFactory(folderManager);
    Authenticator authenticator = createAuthenticator(passwordVerifier);
    Authorizator authorizator = new Authorizator() {

        @Override
        public AuthorizationState canLoginAsOtherUser(String userId, String otherUserId) throws MailboxException {
            return AuthorizationState.UNKNOWN_USER;
        }
    };
    MailboxACLResolver aclResolver = createMailboxACLResolver();
    GroupMembershipResolver groupMembershipResolver = new GroupMembershipResolver() {

        public boolean isMember(String user, String group) {
            return true;
        }
    };
    MessageParser messageParser = new MessageParser();
    MessageId.Factory messageIdFactory = new BoteMessageId.Factory();
    StoreMailboxManager mailboxManager = new StoreMailboxManager(mailboxSessionMapperFactory, authenticator, authorizator, aclResolver, groupMembershipResolver, messageParser, messageIdFactory, 0, 0);
    try {
        mailboxManager.init();
    } catch (MailboxException e) {
        throw new ConfigurationException(e);
    }
    SubscriptionManager subscriptionManager = createSubscriptionManager(folderManager);
    DefaultImapEncoderFactory encoderFactory = new DefaultImapEncoderFactory(new DefaultLocalizer(), true);
    MetricFactory metricFactory = new NoopMetricFactory();
    DefaultImapProcessorFactory processorFactory = new DefaultImapProcessorFactory();
    processorFactory.setMailboxManager(mailboxManager);
    processorFactory.setSubscriptionManager(subscriptionManager);
    processorFactory.setMetricFactory(metricFactory);
    return new ImapService(DefaultImapDecoderFactory.createDecoder(), encoderFactory.buildImapEncoder(), processorFactory.buildImapProcessor(), new ImapMetrics(metricFactory), configuration, mailboxSessionMapperFactory);
}
Also used : MailboxACLResolver(org.apache.james.mailbox.acl.MailboxACLResolver) MailboxException(org.apache.james.mailbox.exception.MailboxException) MessageParser(org.apache.james.mailbox.store.mail.model.impl.MessageParser) DefaultLocalizer(org.apache.james.imap.encode.main.DefaultLocalizer) MetricFactory(org.apache.james.metrics.api.MetricFactory) NoopMetricFactory(org.apache.james.metrics.api.NoopMetricFactory) LoggerFactory(org.slf4j.LoggerFactory) MetricFactory(org.apache.james.metrics.api.MetricFactory) DefaultImapProcessorFactory(org.apache.james.imap.processor.main.DefaultImapProcessorFactory) NoopMetricFactory(org.apache.james.metrics.api.NoopMetricFactory) SSLSocketFactory(javax.net.ssl.SSLSocketFactory) DefaultImapEncoderFactory(org.apache.james.imap.encode.main.DefaultImapEncoderFactory) DefaultImapDecoderFactory(org.apache.james.imap.main.DefaultImapDecoderFactory) StoreMailboxManager(org.apache.james.mailbox.store.StoreMailboxManager) SubscriptionManager(org.apache.james.mailbox.SubscriptionManager) ImapMetrics(org.apache.james.imapserver.netty.ImapMetrics) NoopMetricFactory(org.apache.james.metrics.api.NoopMetricFactory) ConfigurationException(org.apache.commons.configuration.ConfigurationException) GroupMembershipResolver(org.apache.james.mailbox.acl.GroupMembershipResolver) DefaultImapEncoderFactory(org.apache.james.imap.encode.main.DefaultImapEncoderFactory) Authorizator(org.apache.james.mailbox.store.Authorizator) DefaultImapProcessorFactory(org.apache.james.imap.processor.main.DefaultImapProcessorFactory) Authenticator(org.apache.james.mailbox.store.Authenticator) MessageId(org.apache.james.mailbox.model.MessageId)

Aggregations

SSLSocketFactory (javax.net.ssl.SSLSocketFactory)1 ConfigurationException (org.apache.commons.configuration.ConfigurationException)1 DefaultImapEncoderFactory (org.apache.james.imap.encode.main.DefaultImapEncoderFactory)1 DefaultLocalizer (org.apache.james.imap.encode.main.DefaultLocalizer)1 DefaultImapDecoderFactory (org.apache.james.imap.main.DefaultImapDecoderFactory)1 DefaultImapProcessorFactory (org.apache.james.imap.processor.main.DefaultImapProcessorFactory)1 ImapMetrics (org.apache.james.imapserver.netty.ImapMetrics)1 SubscriptionManager (org.apache.james.mailbox.SubscriptionManager)1 GroupMembershipResolver (org.apache.james.mailbox.acl.GroupMembershipResolver)1 MailboxACLResolver (org.apache.james.mailbox.acl.MailboxACLResolver)1 MailboxException (org.apache.james.mailbox.exception.MailboxException)1 MessageId (org.apache.james.mailbox.model.MessageId)1 Authenticator (org.apache.james.mailbox.store.Authenticator)1 Authorizator (org.apache.james.mailbox.store.Authorizator)1 StoreMailboxManager (org.apache.james.mailbox.store.StoreMailboxManager)1 MessageParser (org.apache.james.mailbox.store.mail.model.impl.MessageParser)1 MetricFactory (org.apache.james.metrics.api.MetricFactory)1 NoopMetricFactory (org.apache.james.metrics.api.NoopMetricFactory)1 LoggerFactory (org.slf4j.LoggerFactory)1