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