ConnectionManager class
Generic, provider-agnostic connection manager. Dispatches connections to any AuthProvider
implementation produced by the supplied AuthProviderFactory, while owning the
provider-independent connection routing logic (audience matching, service URL dispatch,
altBlueprintConnectionName handling, default connection resolution).
Constructors
| Connection |
Creates a new ConnectionManager. |
Methods
| get |
Get the OAuth connection for the agent. |
| get |
Get the default OAuth connection for the agent. |
| get |
Get the default connection configuration for the agent. |
| get |
Finds a connection based on a map. |
| get |
Finds a connection based on an activity's blueprint. |
Constructor Details
ConnectionManager(AuthProviderFactory, Map<string, AuthConfiguration>, ConnectionMapItem[], AuthConfiguration)
Creates a new ConnectionManager.
new ConnectionManager(providerFactory?: AuthProviderFactory, connectionsConfigurations?: Map<string, AuthConfiguration>, connectionsMap?: ConnectionMapItem[], configuration?: AuthConfiguration)
Parameters
- providerFactory
- AuthProviderFactory
Factory used to instantiate an AuthProvider for each connection.
- connectionsConfigurations
-
Map<string, AuthConfiguration>
Map of connection names to their authentication configurations.
- connectionsMap
Map items used to route activities to connections.
- configuration
- AuthConfiguration
Fallback authentication configuration (used when the above are empty).
Method Details
getConnection(string)
Get the OAuth connection for the agent.
function getConnection(connectionName: string): AuthProvider
Parameters
- connectionName
-
string
The name of the connection.
Returns
The OAuth connection for the agent.
getDefaultConnection()
Get the default OAuth connection for the agent.
function getDefaultConnection(): AuthProvider
Returns
The default OAuth connection for the agent.
getDefaultConnectionConfiguration()
Get the default connection configuration for the agent.
function getDefaultConnectionConfiguration(): AuthConfiguration
Returns
The default connection configuration for the agent.
getTokenProvider(JwtPayload, string)
Finds a connection based on a map.
function getTokenProvider(identity: JwtPayload, serviceUrl: string): AuthProvider
Parameters
- identity
-
JwtPayload
The identity. Usually TurnContext.identity.
- serviceUrl
-
string
The service URL.
Returns
The TokenProvider for the connection.
getTokenProviderFromActivity(JwtPayload, Activity)
Finds a connection based on an activity's blueprint.
function getTokenProviderFromActivity(identity: JwtPayload, activity: Activity): AuthProvider
Parameters
- identity
-
JwtPayload
The identity. Usually TurnContext.identity.
- activity
- Activity
The activity.
Returns
The TokenProvider for the connection.