Class ResourceOwnerOAuthContextWithRefreshState

    • Constructor Detail

      • ResourceOwnerOAuthContextWithRefreshState

        public ResourceOwnerOAuthContextWithRefreshState​(String resourceOwnerId)
      • ResourceOwnerOAuthContextWithRefreshState

        public ResourceOwnerOAuthContextWithRefreshState​(ResourceOwnerOAuthContext original)
        Since the runtime can be upgraded when there are already contexts stored, previous versions must be migrated to the new one. The newly added state cannot be added to the previous version because that would break the java serialization of those objects.
        Parameters:
        original - the context to migrate
    • Method Detail

      • setAccessToken

        public void setAccessToken​(String accessToken)
      • setRefreshToken

        public void setRefreshToken​(String refreshToken)
      • setExpiresIn

        public void setExpiresIn​(String expiresIn)
      • setState

        public void setState​(String state)
      • setTokenResponseParameters

        public void setTokenResponseParameters​(Map<String,​Object> tokenResponseParameters)
      • setDancerState

        public void setDancerState​(DancerState dancerState)
        Description copied from interface: ResourceOwnerOAuthContext
        Updates the state of the dancer for this context.

        Note that calling this just updates the internal state of this object. Calling this method does not persist this change in any store. That has to be done explicitly after calling this method.

        Specified by:
        setDancerState in interface ResourceOwnerOAuthContext
        Parameters:
        dancerState - the state of the dance for the resource owner of this context.
      • getRefreshOAuthContextLock

        public Lock getRefreshOAuthContextLock​(String lockNamePrefix,
                                               org.mule.runtime.api.lock.LockFactory lockProvider)
        Description copied from interface: ResourceOwnerOAuthContext
        Obtains a lock to avoid triggering a refresh of the context more than once simultaneously.
        Specified by:
        getRefreshOAuthContextLock in interface ResourceOwnerOAuthContext
        Parameters:
        lockNamePrefix - a prefix to uniquely identify the locks in the provided lockFactory.
        lockProvider - the object to get the locks from. This will ensure that the same lock instance is used after serialization/deserialization of this context.
        Returns:
        a lock that can be used to avoid concurrency problems trying to update oauth context.
      • createRefreshOAuthContextLock

        public static Lock createRefreshOAuthContextLock​(String lockNamePrefix,
                                                         org.mule.runtime.api.lock.LockFactory lockProvider,
                                                         String resourceOwnerId)
        This utility method is needed for the cases where the context is being queried. There is still no context created, but the same lock that this context would use is required for querying thread-safely.