The discoverAffinity* methods need to consider and propagate certain information:
- The locator and located action (obviously)
- The effective weak affinity
- The sticky authentication and SSL configurations from naming or legacy configuration
Ideally we could pass the invocation context, but session creation does not use it.
The discoverAffinity methods may rewrite the affinity as it processes. Because of this, it probably makes sense to break out a separate "effective strong affinity" parameter which is initialized from the locator. For example, if a cluster affinity is being processed and there is a weak node or URI affinity, then the next stage can be performed directly using the weak affinity as the new effective strong affinity.
The discover* method for URI affinity does not need a weak affinity parameter because it can never use or propagate weak affinity for any purpose.
The discover methods may use the legacy configuration information from the client context in order to establish or override authentication configuration.