Class MailAccountSource

java.lang.Object
org.exoplatform.bluemind.mail.service.MailAccountSource
All Implemented Interfaces:
org.exoplatform.bluemind.client.BlueMindAccountSource

public class MailAccountSource extends Object implements org.exoplatform.bluemind.client.BlueMindAccountSource
One mail account as bluemind-client asks for it: the connector's BlueMind server, and the login and password the mail host's own session resolves for its caller on the IMAP channel — BlueMind's REST login takes the mailbox's own IMAP password, or the session id a credentials provider presents as one. Values only: nothing of the host's credentials resolver, which is a @Component the Kernel/Spring bridge does not export.

Who a session is kept for. The mail connector, in the "mail:" namespace of the add-on's one session cache; the eXo user the host's session acts as; the login the resolved material names, which is the account the session will be BlueMind's for; and the mail origin. A session is therefore reused only for the same user on the same connector whose credentials name the same account, and a calendar registration sharing the connector's id never meets it.

A refused login reaches the provider once. When the provider may produce fresh material (MailboxAclSession.retriesAfterRefusal()), the client tells it through invalidate() and logs in once more; when it may not, the caller tells it through reportRefusal() after the call failed, and nothing is sent again. Either way the provider hears of a refusal exactly once per call.

Not a bean: one per call, over the session the host handed the engine. Nothing it holds outlives the call.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    What the mail side names itself as in BlueMind's login audit.
    static final String
    The namespace of the mail connectors' ids in the add-on's one session cache.
  • Constructor Summary

    Constructors
    Constructor
    Description
    MailAccountSource(org.exoplatform.emailConnector.service.acl.MailboxAclSession session, URI server, javax.mail.PasswordAuthentication material)
    The source of one call, over material the host's session resolved.
  • Method Summary

    Modifier and Type
    Method
    Description
    org.exoplatform.bluemind.client.model.BlueMindAccount
    The account a login is made with: the material this call started with, or fresh material after invalidate().
    The connector's BlueMind server, without producing anything.
    void
    Tells the provider its material was refused, so that the next account() resolves fresh material.
    boolean
    Whether a refused login is worth one more on fresh material: the provider's answer, through the host's session.
    void
    Tells the provider its material was refused, once: after a call that failed with an authentication refusal once a login was made with the material, unless the client already told it.
    org.exoplatform.bluemind.client.model.BlueMindSessionKey

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • LOGIN_ORIGIN

      public static final String LOGIN_ORIGIN
      What the mail side names itself as in BlueMind's login audit.
      See Also:
    • SERVER_NAMESPACE

      public static final String SERVER_NAMESPACE
      The namespace of the mail connectors' ids in the add-on's one session cache.
      See Also:
  • Constructor Details

    • MailAccountSource

      public MailAccountSource(org.exoplatform.emailConnector.service.acl.MailboxAclSession session, URI server, javax.mail.PasswordAuthentication material)
      The source of one call, over material the host's session resolved.
      Parameters:
      session - the caller's own session
      server - the connector's BlueMind server
      material - the login and password the session resolved, not blank
  • Method Details

    • apiRoot

      public URI apiRoot()
      The connector's BlueMind server, without producing anything.
      Specified by:
      apiRoot in interface org.exoplatform.bluemind.client.BlueMindAccountSource
      Returns:
      the server's address
    • account

      public org.exoplatform.bluemind.client.model.BlueMindAccount account()
      The account a login is made with: the material this call started with, or fresh material after invalidate().
      Specified by:
      account in interface org.exoplatform.bluemind.client.BlueMindAccountSource
      Returns:
      the account
      Throws:
      org.exoplatform.bluemind.client.exception.BlueMindAuthenticationException - when the session resolves no login and password, or fresh material naming another account than the one the session is kept for
      org.exoplatform.emailConnector.exception.MailboxAclException - when the provider cannot produce material
    • sessionKey

      public org.exoplatform.bluemind.client.model.BlueMindSessionKey sessionKey()
      Specified by:
      sessionKey in interface org.exoplatform.bluemind.client.BlueMindAccountSource
    • refreshable

      public boolean refreshable()
      Whether a refused login is worth one more on fresh material: the provider's answer, through the host's session.
      Specified by:
      refreshable in interface org.exoplatform.bluemind.client.BlueMindAccountSource
      Returns:
      true when the provider produces its material itself
    • invalidate

      public void invalidate()
      Tells the provider its material was refused, so that the next account() resolves fresh material.
      Specified by:
      invalidate in interface org.exoplatform.bluemind.client.BlueMindAccountSource
    • reportRefusal

      public void reportRefusal()
      Tells the provider its material was refused, once: after a call that failed with an authentication refusal once a login was made with the material, unless the client already told it.