Class CaldavAccountSource

java.lang.Object
org.exoplatform.bluemind.calendar.service.CaldavAccountSource
All Implemented Interfaces:
org.exoplatform.bluemind.client.BlueMindAccountSource

public class CaldavAccountSource extends Object implements org.exoplatform.bluemind.client.BlueMindAccountSource
One calendar account as bluemind-client asks for it: the server the endpoint was minted for, and the login and password the registration's credentials provider produces for the endpoint's eXo user — decoded from the Basic header the calendar host sends on its DAV requests, exactly as the host's own REST session did.

Why over the host's resolver class and not its bean. The calendar host's CaldavCredentialsResolver is a @Component, which the Kernel/Spring bridge does not export to another web application. The add-on therefore builds its own instance of that same class over commons-exo's ConnectorCredentialsService — a @Service, so exported — which is everything the host's bean holds. The credentials context (the connector kind caldav, the HTTP channel, the server id) is the host's by construction, so the provider sees the same request whichever web application asks.

Not a bean: one per call, over the endpoint the host handed in.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    What the calendar side names itself as in BlueMind's login audit.
  • Constructor Summary

    Constructors
    Constructor
    Description
    CaldavAccountSource(org.exoplatform.caldav.client.CalDavEndpoint endpoint, org.exoplatform.caldav.provider.CaldavCredentialsResolver caldavCredentialsResolver)
    The source of one endpoint's account, whose session is not kept.
    CaldavAccountSource(org.exoplatform.caldav.client.CalDavEndpoint endpoint, org.exoplatform.caldav.provider.CaldavCredentialsResolver caldavCredentialsResolver, org.exoplatform.bluemind.client.model.BlueMindSessionKey sessionKey)
    The source of one endpoint's account, with the key its session is kept under — built from that same endpoint (BlueMindCalendarSessions.keyOf(org.exoplatform.caldav.client.CalDavEndpoint)), so that the key and the credentials name one account.
  • Method Summary

    Modifier and Type
    Method
    Description
    org.exoplatform.bluemind.client.model.BlueMindAccount
    The login and password the configured provider produces for the endpoint's user, per call — never kept here, since material can expire between two calls.
    The declared server, without producing any credentials.
    void
    Tells the provider the material it produced was refused, so that the next production is fresh.
    boolean
    Whether a refused login deserves one more on fresh material: only for an endpoint minted for an eXo user, whose provider produces its material itself (EXO-89649) — a provider carrying what the user typed would hand the same password back, and a second refusal would count against the user's account.
    org.exoplatform.bluemind.client.model.BlueMindSessionKey
    Who a session opened with this endpoint's credentials is kept for.

    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 calendar side names itself as in BlueMind's login audit.
      See Also:
  • Constructor Details

    • CaldavAccountSource

      public CaldavAccountSource(org.exoplatform.caldav.client.CalDavEndpoint endpoint, org.exoplatform.caldav.provider.CaldavCredentialsResolver caldavCredentialsResolver)
      The source of one endpoint's account, whose session is not kept.
      Parameters:
      endpoint - the account's endpoint
      caldavCredentialsResolver - the credentials seam
    • CaldavAccountSource

      public CaldavAccountSource(org.exoplatform.caldav.client.CalDavEndpoint endpoint, org.exoplatform.caldav.provider.CaldavCredentialsResolver caldavCredentialsResolver, org.exoplatform.bluemind.client.model.BlueMindSessionKey sessionKey)
      The source of one endpoint's account, with the key its session is kept under — built from that same endpoint (BlueMindCalendarSessions.keyOf(org.exoplatform.caldav.client.CalDavEndpoint)), so that the key and the credentials name one account.
      Parameters:
      endpoint - the account's endpoint
      caldavCredentialsResolver - the credentials seam
      sessionKey - who the session is kept for, or null when it must not be
  • Method Details

    • apiRoot

      public URI apiRoot()
      The declared server, without producing any credentials.
      Specified by:
      apiRoot in interface org.exoplatform.bluemind.client.BlueMindAccountSource
      Returns:
      the endpoint's base address
    • account

      public org.exoplatform.bluemind.client.model.BlueMindAccount account()
      The login and password the configured provider produces for the endpoint's user, per call — never kept here, since material can expire between two calls.
      Specified by:
      account in interface org.exoplatform.bluemind.client.BlueMindAccountSource
      Returns:
      the account
      Throws:
      UnsupportedOperationException - when the provider produces anything but a Basic login and password
      org.exoplatform.caldav.client.CalDavException - when the provider cannot produce credentials at all — deliberately not an authentication refusal, which would pause the user's account for what is the connector's fault
    • sessionKey

      public org.exoplatform.bluemind.client.model.BlueMindSessionKey sessionKey()
      Who a session opened with this endpoint's credentials is kept for.
      Specified by:
      sessionKey in interface org.exoplatform.bluemind.client.BlueMindAccountSource
      Returns:
      the caldav:-namespaced key, or null when the session is opened and closed by its own call
    • refreshable

      public boolean refreshable()
      Whether a refused login deserves one more on fresh material: only for an endpoint minted for an eXo user, whose provider produces its material itself (EXO-89649) — a provider carrying what the user typed would hand the same password back, and a second refusal would count against the user's account.
      Specified by:
      refreshable in interface org.exoplatform.bluemind.client.BlueMindAccountSource
      Returns:
      true when a retry on fresh material makes sense
    • invalidate

      public void invalidate()
      Tells the provider the material it produced was refused, so that the next production is fresh.
      Specified by:
      invalidate in interface org.exoplatform.bluemind.client.BlueMindAccountSource