declare new interface ICredentialTokenProvider to make sure of backward compatibility
This commit is contained in:
Родитель
09abfee845
Коммит
342ec74d3b
|
@ -143,7 +143,7 @@ namespace Microsoft.Bot.Builder.Dialogs
|
|||
state[PersistedExpires] = DateTime.Now.AddMilliseconds(timeout);
|
||||
|
||||
// Attempt to get the users token
|
||||
if (!(dc.Context.Adapter is IUserTokenProvider adapter))
|
||||
if (!(dc.Context.Adapter is ICredentialTokenProvider adapter))
|
||||
{
|
||||
throw new InvalidOperationException("OAuthPrompt.Recognize(): not supported by the current adapter");
|
||||
}
|
||||
|
@ -237,7 +237,7 @@ namespace Microsoft.Bot.Builder.Dialogs
|
|||
/// the result contains the user's token.</remarks>
|
||||
public async Task<TokenResponse> GetUserTokenAsync(ITurnContext turnContext, CancellationToken cancellationToken = default(CancellationToken))
|
||||
{
|
||||
if (!(turnContext.Adapter is IUserTokenProvider adapter))
|
||||
if (!(turnContext.Adapter is ICredentialTokenProvider adapter))
|
||||
{
|
||||
throw new InvalidOperationException("OAuthPrompt.GetUserToken(): not supported by the current adapter");
|
||||
}
|
||||
|
@ -254,7 +254,7 @@ namespace Microsoft.Bot.Builder.Dialogs
|
|||
/// <returns>A task that represents the work queued to execute.</returns>
|
||||
public async Task SignOutUserAsync(ITurnContext turnContext, CancellationToken cancellationToken = default(CancellationToken))
|
||||
{
|
||||
if (!(turnContext.Adapter is IUserTokenProvider adapter))
|
||||
if (!(turnContext.Adapter is ICredentialTokenProvider adapter))
|
||||
{
|
||||
throw new InvalidOperationException("OAuthPrompt.SignOutUser(): not supported by the current adapter");
|
||||
}
|
||||
|
@ -293,7 +293,7 @@ namespace Microsoft.Bot.Builder.Dialogs
|
|||
{
|
||||
BotAssert.ContextNotNull(turnContext);
|
||||
|
||||
if (!(turnContext.Adapter is IUserTokenProvider adapter))
|
||||
if (!(turnContext.Adapter is ICredentialTokenProvider adapter))
|
||||
{
|
||||
throw new InvalidOperationException("OAuthPrompt.Prompt(): not supported by the current adapter");
|
||||
}
|
||||
|
@ -401,7 +401,7 @@ namespace Microsoft.Bot.Builder.Dialogs
|
|||
var magicCodeObject = turnContext.Activity.Value as JObject;
|
||||
var magicCode = magicCodeObject.GetValue("state")?.ToString();
|
||||
|
||||
if (!(turnContext.Adapter is IUserTokenProvider adapter))
|
||||
if (!(turnContext.Adapter is ICredentialTokenProvider adapter))
|
||||
{
|
||||
throw new InvalidOperationException("OAuthPrompt.Recognize(): not supported by the current adapter");
|
||||
}
|
||||
|
@ -439,7 +439,7 @@ namespace Microsoft.Bot.Builder.Dialogs
|
|||
var matched = _magicCodeRegex.Match(turnContext.Activity.Text);
|
||||
if (matched.Success)
|
||||
{
|
||||
if (!(turnContext.Adapter is IUserTokenProvider adapter))
|
||||
if (!(turnContext.Adapter is ICredentialTokenProvider adapter))
|
||||
{
|
||||
throw new InvalidOperationException("OAuthPrompt.Recognize(): not supported by the current adapter");
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace Microsoft.Bot.Builder.Adapters
|
|||
/// A mock adapter that can be used for unit testing of bot logic.
|
||||
/// </summary>
|
||||
/// <seealso cref="TestFlow"/>
|
||||
public class TestAdapter : BotAdapter, IUserTokenProvider
|
||||
public class TestAdapter : BotAdapter, ICredentialTokenProvider
|
||||
{
|
||||
private bool _sendTraceActivity;
|
||||
private readonly object _conversationLock = new object();
|
||||
|
@ -146,7 +146,7 @@ namespace Microsoft.Bot.Builder.Adapters
|
|||
/// <param name="cancellationToken">A cancellation token that can be used by other objects
|
||||
/// or threads to receive notice of cancellation.</param>
|
||||
/// <returns>A task that represents the work queued to execute.</returns>
|
||||
public async Task ProcessActivityAsync(Activity activity, BotCallbackHandler callback, CancellationToken cancellationToken = default(CancellationToken))
|
||||
public async Task ProcessActivityAsync(Activity activity, BotCallbackHandler callback, CancellationToken cancellationToken = default)
|
||||
{
|
||||
lock (_conversationLock)
|
||||
{
|
||||
|
@ -529,7 +529,7 @@ namespace Microsoft.Bot.Builder.Adapters
|
|||
/// <returns>The signin link.</returns>
|
||||
public virtual Task<string> GetOauthSignInLinkAsync(ITurnContext turnContext, AppCredentials oAuthAppCredentials, string connectionName, CancellationToken cancellationToken)
|
||||
{
|
||||
return GetOauthSignInLinkAsync(turnContext, oAuthAppCredentials, connectionName, turnContext.Activity.From.Id, null, cancellationToken);
|
||||
return Task.FromResult($"https://fake.com/oauthsignin/{connectionName}/{turnContext.Activity.ChannelId}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -541,7 +541,7 @@ namespace Microsoft.Bot.Builder.Adapters
|
|||
/// <returns>The signin link.</returns>
|
||||
public virtual Task<string> GetOauthSignInLinkAsync(ITurnContext turnContext, string connectionName, CancellationToken cancellationToken)
|
||||
{
|
||||
return GetOauthSignInLinkAsync(turnContext, null, connectionName, turnContext.Activity.From.Id, null, cancellationToken);
|
||||
return GetOauthSignInLinkAsync(turnContext, null, connectionName, cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -554,7 +554,7 @@ namespace Microsoft.Bot.Builder.Adapters
|
|||
/// <param name="finalRedirect">The final redirect value, which is ignored here.</param>
|
||||
/// <param name="cancellationToken">A Task cancellationToken.</param>
|
||||
/// <returns>The signin link.</returns>
|
||||
public virtual Task<string> GetOauthSignInLinkAsync(ITurnContext turnContext, AppCredentials oAuthAppCredentials, string connectionName, string userId, string finalRedirect = null, CancellationToken cancellationToken = default(CancellationToken))
|
||||
public virtual Task<string> GetOauthSignInLinkAsync(ITurnContext turnContext, AppCredentials oAuthAppCredentials, string connectionName, string userId, string finalRedirect = null, CancellationToken cancellationToken = default)
|
||||
{
|
||||
return Task.FromResult($"https://fake.com/oauthsignin/{connectionName}/{turnContext.Activity.ChannelId}/{userId}");
|
||||
}
|
||||
|
@ -568,9 +568,9 @@ namespace Microsoft.Bot.Builder.Adapters
|
|||
/// <param name="finalRedirect">The final redirect value, which is ignored here.</param>
|
||||
/// <param name="cancellationToken">A Task cancellationToken.</param>
|
||||
/// <returns>The signin link.</returns>
|
||||
public virtual Task<string> GetOauthSignInLinkAsync(ITurnContext turnContext, string connectionName, string userId, string finalRedirect = null, CancellationToken cancellationToken = default(CancellationToken))
|
||||
public virtual Task<string> GetOauthSignInLinkAsync(ITurnContext turnContext, string connectionName, string userId, string finalRedirect = null, CancellationToken cancellationToken = default)
|
||||
{
|
||||
return Task.FromResult($"https://fake.com/oauthsignin/{connectionName}/{turnContext.Activity.ChannelId}/{userId}");
|
||||
return GetOauthSignInLinkAsync(turnContext, null, connectionName, userId, finalRedirect, cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -582,7 +582,7 @@ namespace Microsoft.Bot.Builder.Adapters
|
|||
/// <param name="userId">The userId.</param>
|
||||
/// <param name="cancellationToken">The Task cancellation token.</param>
|
||||
/// <returns>None.</returns>
|
||||
public virtual Task SignOutUserAsync(ITurnContext turnContext, AppCredentials oAuthAppCredentials, string connectionName = null, string userId = null, CancellationToken cancellationToken = default(CancellationToken))
|
||||
public virtual Task SignOutUserAsync(ITurnContext turnContext, AppCredentials oAuthAppCredentials, string connectionName = null, string userId = null, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var channelId = turnContext.Activity.ChannelId;
|
||||
userId = userId ?? turnContext.Activity.From.Id;
|
||||
|
@ -609,7 +609,7 @@ namespace Microsoft.Bot.Builder.Adapters
|
|||
/// <param name="userId">The userId.</param>
|
||||
/// <param name="cancellationToken">The Task cancellation token.</param>
|
||||
/// <returns>None.</returns>
|
||||
public virtual Task SignOutUserAsync(ITurnContext turnContext, string connectionName = null, string userId = null, CancellationToken cancellationToken = default(CancellationToken))
|
||||
public virtual Task SignOutUserAsync(ITurnContext turnContext, string connectionName = null, string userId = null, CancellationToken cancellationToken = default)
|
||||
{
|
||||
return SignOutUserAsync(turnContext, null, connectionName, userId, cancellationToken);
|
||||
}
|
||||
|
@ -623,7 +623,7 @@ namespace Microsoft.Bot.Builder.Adapters
|
|||
/// <param name="includeFilter">Optional comma separated list of connection's to include. Blank will return token status for all configured connections.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>Array of TokenStatus.</returns>
|
||||
public virtual Task<TokenStatus[]> GetTokenStatusAsync(ITurnContext context, AppCredentials oAuthAppCredentials, string userId, string includeFilter = null, CancellationToken cancellationToken = default(CancellationToken))
|
||||
public virtual Task<TokenStatus[]> GetTokenStatusAsync(ITurnContext context, AppCredentials oAuthAppCredentials, string userId, string includeFilter = null, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var filter = includeFilter == null ? null : includeFilter.Split(',');
|
||||
var records = _userTokens.
|
||||
|
@ -649,7 +649,7 @@ namespace Microsoft.Bot.Builder.Adapters
|
|||
/// <param name="includeFilter">Optional comma separated list of connection's to include. Blank will return token status for all configured connections.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>Array of TokenStatus.</returns>
|
||||
public virtual Task<TokenStatus[]> GetTokenStatusAsync(ITurnContext context, string userId, string includeFilter = null, CancellationToken cancellationToken = default(CancellationToken))
|
||||
public virtual Task<TokenStatus[]> GetTokenStatusAsync(ITurnContext context, string userId, string includeFilter = null, CancellationToken cancellationToken = default)
|
||||
{
|
||||
return GetTokenStatusAsync(context, null, userId, includeFilter, cancellationToken);
|
||||
}
|
||||
|
@ -664,7 +664,7 @@ namespace Microsoft.Bot.Builder.Adapters
|
|||
/// <param name="userId">The user ID.</param>
|
||||
/// <param name="cancellationToken">The cancellationToken.</param>
|
||||
/// <returns>The dictionary of TokenResponses for each resource URL.</returns>
|
||||
public virtual Task<Dictionary<string, TokenResponse>> GetAadTokensAsync(ITurnContext context, AppCredentials oAuthAppCredentials, string connectionName, string[] resourceUrls, string userId = null, CancellationToken cancellationToken = default(CancellationToken))
|
||||
public virtual Task<Dictionary<string, TokenResponse>> GetAadTokensAsync(ITurnContext context, AppCredentials oAuthAppCredentials, string connectionName, string[] resourceUrls, string userId = null, CancellationToken cancellationToken = default)
|
||||
{
|
||||
return Task.FromResult(new Dictionary<string, TokenResponse>());
|
||||
}
|
||||
|
@ -678,7 +678,7 @@ namespace Microsoft.Bot.Builder.Adapters
|
|||
/// <param name="userId">The user ID.</param>
|
||||
/// <param name="cancellationToken">The cancellationToken.</param>
|
||||
/// <returns>The dictionary of TokenResponses for each resource URL.</returns>
|
||||
public virtual Task<Dictionary<string, TokenResponse>> GetAadTokensAsync(ITurnContext context, string connectionName, string[] resourceUrls, string userId = null, CancellationToken cancellationToken = default(CancellationToken))
|
||||
public virtual Task<Dictionary<string, TokenResponse>> GetAadTokensAsync(ITurnContext context, string connectionName, string[] resourceUrls, string userId = null, CancellationToken cancellationToken = default)
|
||||
{
|
||||
return GetAadTokensAsync(context, null, connectionName, resourceUrls, userId, cancellationToken);
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ namespace Microsoft.Bot.Builder
|
|||
/// <seealso cref="IActivity"/>
|
||||
/// <seealso cref="IBot"/>
|
||||
/// <seealso cref="IMiddleware"/>
|
||||
public class BotFrameworkAdapter : BotAdapter, IAdapterIntegration, IUserTokenProvider
|
||||
public class BotFrameworkAdapter : BotAdapter, IAdapterIntegration, ICredentialTokenProvider
|
||||
{
|
||||
internal const string InvokeResponseKey = "BotFrameworkAdapter.InvokeResponse";
|
||||
internal const string BotIdentityKey = "BotIdentity";
|
||||
|
@ -1081,12 +1081,12 @@ namespace Microsoft.Bot.Builder
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates an OAuth client for the bot.
|
||||
/// Creates an OAuth client for the bot with the credentials.
|
||||
/// </summary>
|
||||
/// <param name="turnContext">The context object for the current turn.</param>
|
||||
/// <param name="oAuthAppCredentials">AppCredentials for OAuth.</param>
|
||||
/// <returns>An OAuth client for the bot.</returns>
|
||||
protected virtual async Task<OAuthClient> CreateOAuthApiClientAsync(ITurnContext turnContext, AppCredentials oAuthAppCredentials = null)
|
||||
protected virtual async Task<OAuthClient> CreateOAuthApiClientAsync(ITurnContext turnContext, AppCredentials oAuthAppCredentials)
|
||||
{
|
||||
if (!OAuthClientConfig.EmulateOAuthCards &&
|
||||
string.Equals(turnContext.Activity.ChannelId, Channels.Emulator, StringComparison.InvariantCultureIgnoreCase) &&
|
||||
|
@ -1135,6 +1135,16 @@ namespace Microsoft.Bot.Builder
|
|||
return oAuthClient;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates an OAuth client for the bot.
|
||||
/// </summary>
|
||||
/// <param name="turnContext">The context object for the current turn.</param>
|
||||
/// <returns>An OAuth client for the bot.</returns>
|
||||
protected virtual async Task<OAuthClient> CreateOAuthApiClientAsync(ITurnContext turnContext)
|
||||
{
|
||||
return await CreateOAuthApiClientAsync(turnContext, null).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Opportunity for subclasses to opt in to process an outgoing activity.
|
||||
/// </summary>
|
||||
|
|
|
@ -0,0 +1,87 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Bot.Connector.Authentication;
|
||||
using Microsoft.Bot.Schema;
|
||||
|
||||
namespace Microsoft.Bot.Builder
|
||||
{
|
||||
public interface ICredentialTokenProvider : IUserTokenProvider
|
||||
{
|
||||
/// <summary>Attempts to retrieve the token for a user that's in a login flow, using customized AppCredentials.
|
||||
/// </summary>
|
||||
/// <param name="turnContext">Context for the current turn of conversation with the user.</param>
|
||||
/// <param name="oAuthAppCredentials">AppCredentials for OAuth.</param>
|
||||
/// <param name="connectionName">Name of the auth connection to use.</param>
|
||||
/// <param name="magicCode">(Optional) Optional user entered code to validate.</param>
|
||||
/// <param name="cancellationToken">Cancellation token.</param>
|
||||
/// <returns>Token Response.</returns>
|
||||
Task<TokenResponse> GetUserTokenAsync(ITurnContext turnContext, AppCredentials oAuthAppCredentials, string connectionName, string magicCode, CancellationToken cancellationToken);
|
||||
|
||||
/// <summary>
|
||||
/// Get the raw signin link to be sent to the user for signin for a connection name, using customized AppCredentials.
|
||||
/// </summary>
|
||||
/// <param name="turnContext">Context for the current turn of conversation with the user.</param>
|
||||
/// <param name="oAuthAppCredentials">AppCredentials for OAuth.</param>
|
||||
/// <param name="connectionName">Name of the auth connection to use.</param>
|
||||
/// <param name="cancellationToken">A cancellation token that can be used by other objects
|
||||
/// or threads to receive notice of cancellation.</param>
|
||||
/// <returns>A task that represents the work queued to execute.</returns>
|
||||
/// <remarks>If the task completes successfully, the result contains the raw signin link.</remarks>
|
||||
Task<string> GetOauthSignInLinkAsync(ITurnContext turnContext, AppCredentials oAuthAppCredentials, string connectionName, CancellationToken cancellationToken);
|
||||
|
||||
/// <summary>
|
||||
/// Get the raw signin link to be sent to the user for signin for a connection name, using customized AppCredentials.
|
||||
/// </summary>
|
||||
/// <param name="turnContext">Context for the current turn of conversation with the user.</param>
|
||||
/// <param name="oAuthAppCredentials">AppCredentials for OAuth.</param>
|
||||
/// <param name="connectionName">Name of the auth connection to use.</param>
|
||||
/// <param name="userId">The user id that will be associated with the token.</param>
|
||||
/// <param name="finalRedirect">The final URL that the OAuth flow will redirect to.</param>
|
||||
/// <param name="cancellationToken">A cancellation token that can be used by other objects
|
||||
/// or threads to receive notice of cancellation.</param>
|
||||
/// <returns>A task that represents the work queued to execute.</returns>
|
||||
/// <remarks>If the task completes successfully, the result contains the raw signin link.</remarks>
|
||||
Task<string> GetOauthSignInLinkAsync(ITurnContext turnContext, AppCredentials oAuthAppCredentials, string connectionName, string userId, string finalRedirect = null, CancellationToken cancellationToken = default(CancellationToken));
|
||||
|
||||
/// <summary>
|
||||
/// Signs the user out with the token server, using customized AppCredentials.
|
||||
/// </summary>
|
||||
/// <param name="turnContext">Context for the current turn of conversation with the user.</param>
|
||||
/// <param name="oAuthAppCredentials">AppCredentials for OAuth.</param>
|
||||
/// <param name="connectionName">Name of the auth connection to use.</param>
|
||||
/// <param name="userId">User id of user to sign out.</param>
|
||||
/// <param name="cancellationToken">A cancellation token that can be used by other objects
|
||||
/// or threads to receive notice of cancellation.</param>
|
||||
/// <returns>A task that represents the work queued to execute.</returns>
|
||||
Task SignOutUserAsync(ITurnContext turnContext, AppCredentials oAuthAppCredentials, string connectionName = null, string userId = null, CancellationToken cancellationToken = default(CancellationToken));
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the token status for each configured connection for the given user, using customized AppCredentials.
|
||||
/// </summary>
|
||||
/// <param name="context">Context for the current turn of conversation with the user.</param>
|
||||
/// <param name="oAuthAppCredentials">AppCredentials for OAuth.</param>
|
||||
/// <param name="userId">The user Id for which token status is retrieved.</param>
|
||||
/// <param name="includeFilter">Optional comma separated list of connection's to include. Blank will return token status for all configured connections.</param>
|
||||
/// <param name="cancellationToken">A cancellation token that can be used by other objects
|
||||
/// or threads to receive notice of cancellation.</param>
|
||||
/// <returns>Array of TokenStatus.</returns>
|
||||
Task<TokenStatus[]> GetTokenStatusAsync(ITurnContext context, AppCredentials oAuthAppCredentials, string userId, string includeFilter = null, CancellationToken cancellationToken = default(CancellationToken));
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves Azure Active Directory tokens for particular resources on a configured connection, using customized AppCredentials.
|
||||
/// </summary>
|
||||
/// <param name="context">Context for the current turn of conversation with the user.</param>
|
||||
/// <param name="oAuthAppCredentials">AppCredentials for OAuth.</param>
|
||||
/// <param name="connectionName">The name of the Azure Active Directory connection configured with this bot.</param>
|
||||
/// <param name="resourceUrls">The list of resource URLs to retrieve tokens for.</param>
|
||||
/// <param name="userId">The user Id for which tokens are retrieved. If passing in null the userId is taken from the Activity in the ITurnContext.</param>
|
||||
/// <param name="cancellationToken">A cancellation token that can be used by other objects
|
||||
/// or threads to receive notice of cancellation.</param>
|
||||
/// <returns>Dictionary of resourceUrl to the corresponding TokenResponse.</returns>
|
||||
Task<Dictionary<string, TokenResponse>> GetAadTokensAsync(ITurnContext context, AppCredentials oAuthAppCredentials, string connectionName, string[] resourceUrls, string userId = null, CancellationToken cancellationToken = default(CancellationToken));
|
||||
}
|
||||
}
|
|
@ -11,16 +11,6 @@ namespace Microsoft.Bot.Builder
|
|||
{
|
||||
public interface IUserTokenProvider
|
||||
{
|
||||
/// <summary>Attempts to retrieve the token for a user that's in a login flow, using customized AppCredentials.
|
||||
/// </summary>
|
||||
/// <param name="turnContext">Context for the current turn of conversation with the user.</param>
|
||||
/// <param name="oAuthAppCredentials">AppCredentials for OAuth.</param>
|
||||
/// <param name="connectionName">Name of the auth connection to use.</param>
|
||||
/// <param name="magicCode">(Optional) Optional user entered code to validate.</param>
|
||||
/// <param name="cancellationToken">Cancellation token.</param>
|
||||
/// <returns>Token Response.</returns>
|
||||
Task<TokenResponse> GetUserTokenAsync(ITurnContext turnContext, AppCredentials oAuthAppCredentials, string connectionName, string magicCode, CancellationToken cancellationToken);
|
||||
|
||||
/// <summary>Attempts to retrieve the token for a user that's in a login flow, using the bot's AppCredentials.
|
||||
/// </summary>
|
||||
/// <param name="turnContext">Context for the current turn of conversation with the user.</param>
|
||||
|
@ -30,18 +20,6 @@ namespace Microsoft.Bot.Builder
|
|||
/// <returns>Token Response.</returns>
|
||||
Task<TokenResponse> GetUserTokenAsync(ITurnContext turnContext, string connectionName, string magicCode, CancellationToken cancellationToken);
|
||||
|
||||
/// <summary>
|
||||
/// Get the raw signin link to be sent to the user for signin for a connection name, using customized AppCredentials.
|
||||
/// </summary>
|
||||
/// <param name="turnContext">Context for the current turn of conversation with the user.</param>
|
||||
/// <param name="oAuthAppCredentials">AppCredentials for OAuth.</param>
|
||||
/// <param name="connectionName">Name of the auth connection to use.</param>
|
||||
/// <param name="cancellationToken">A cancellation token that can be used by other objects
|
||||
/// or threads to receive notice of cancellation.</param>
|
||||
/// <returns>A task that represents the work queued to execute.</returns>
|
||||
/// <remarks>If the task completes successfully, the result contains the raw signin link.</remarks>
|
||||
Task<string> GetOauthSignInLinkAsync(ITurnContext turnContext, AppCredentials oAuthAppCredentials, string connectionName, CancellationToken cancellationToken);
|
||||
|
||||
/// <summary>
|
||||
/// Get the raw signin link to be sent to the user for signin for a connection name, using the bot's AppCredentials.
|
||||
/// </summary>
|
||||
|
@ -53,20 +31,6 @@ namespace Microsoft.Bot.Builder
|
|||
/// <remarks>If the task completes successfully, the result contains the raw signin link.</remarks>
|
||||
Task<string> GetOauthSignInLinkAsync(ITurnContext turnContext, string connectionName, CancellationToken cancellationToken);
|
||||
|
||||
/// <summary>
|
||||
/// Get the raw signin link to be sent to the user for signin for a connection name, using customized AppCredentials.
|
||||
/// </summary>
|
||||
/// <param name="turnContext">Context for the current turn of conversation with the user.</param>
|
||||
/// <param name="oAuthAppCredentials">AppCredentials for OAuth.</param>
|
||||
/// <param name="connectionName">Name of the auth connection to use.</param>
|
||||
/// <param name="userId">The user id that will be associated with the token.</param>
|
||||
/// <param name="finalRedirect">The final URL that the OAuth flow will redirect to.</param>
|
||||
/// <param name="cancellationToken">A cancellation token that can be used by other objects
|
||||
/// or threads to receive notice of cancellation.</param>
|
||||
/// <returns>A task that represents the work queued to execute.</returns>
|
||||
/// <remarks>If the task completes successfully, the result contains the raw signin link.</remarks>
|
||||
Task<string> GetOauthSignInLinkAsync(ITurnContext turnContext, AppCredentials oAuthAppCredentials, string connectionName, string userId, string finalRedirect = null, CancellationToken cancellationToken = default(CancellationToken));
|
||||
|
||||
/// <summary>
|
||||
/// Get the raw signin link to be sent to the user for signin for a connection name, using the bot's AppCredentials.
|
||||
/// </summary>
|
||||
|
@ -80,18 +44,6 @@ namespace Microsoft.Bot.Builder
|
|||
/// <remarks>If the task completes successfully, the result contains the raw signin link.</remarks>
|
||||
Task<string> GetOauthSignInLinkAsync(ITurnContext turnContext, string connectionName, string userId, string finalRedirect = null, CancellationToken cancellationToken = default(CancellationToken));
|
||||
|
||||
/// <summary>
|
||||
/// Signs the user out with the token server, using customized AppCredentials.
|
||||
/// </summary>
|
||||
/// <param name="turnContext">Context for the current turn of conversation with the user.</param>
|
||||
/// <param name="oAuthAppCredentials">AppCredentials for OAuth.</param>
|
||||
/// <param name="connectionName">Name of the auth connection to use.</param>
|
||||
/// <param name="userId">User id of user to sign out.</param>
|
||||
/// <param name="cancellationToken">A cancellation token that can be used by other objects
|
||||
/// or threads to receive notice of cancellation.</param>
|
||||
/// <returns>A task that represents the work queued to execute.</returns>
|
||||
Task SignOutUserAsync(ITurnContext turnContext, AppCredentials oAuthAppCredentials, string connectionName = null, string userId = null, CancellationToken cancellationToken = default(CancellationToken));
|
||||
|
||||
/// <summary>
|
||||
/// Signs the user out with the token server, using the bot's AppCredentials.
|
||||
/// </summary>
|
||||
|
@ -103,18 +55,6 @@ namespace Microsoft.Bot.Builder
|
|||
/// <returns>A task that represents the work queued to execute.</returns>
|
||||
Task SignOutUserAsync(ITurnContext turnContext, string connectionName = null, string userId = null, CancellationToken cancellationToken = default(CancellationToken));
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the token status for each configured connection for the given user, using customized AppCredentials.
|
||||
/// </summary>
|
||||
/// <param name="context">Context for the current turn of conversation with the user.</param>
|
||||
/// <param name="oAuthAppCredentials">AppCredentials for OAuth.</param>
|
||||
/// <param name="userId">The user Id for which token status is retrieved.</param>
|
||||
/// <param name="includeFilter">Optional comma separated list of connection's to include. Blank will return token status for all configured connections.</param>
|
||||
/// <param name="cancellationToken">A cancellation token that can be used by other objects
|
||||
/// or threads to receive notice of cancellation.</param>
|
||||
/// <returns>Array of TokenStatus.</returns>
|
||||
Task<TokenStatus[]> GetTokenStatusAsync(ITurnContext context, AppCredentials oAuthAppCredentials, string userId, string includeFilter = null, CancellationToken cancellationToken = default(CancellationToken));
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the token status for each configured connection for the given user, using the bot's AppCredentials.
|
||||
/// </summary>
|
||||
|
@ -126,19 +66,6 @@ namespace Microsoft.Bot.Builder
|
|||
/// <returns>Array of TokenStatus.</returns>
|
||||
Task<TokenStatus[]> GetTokenStatusAsync(ITurnContext context, string userId, string includeFilter = null, CancellationToken cancellationToken = default(CancellationToken));
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves Azure Active Directory tokens for particular resources on a configured connection, using customized AppCredentials.
|
||||
/// </summary>
|
||||
/// <param name="context">Context for the current turn of conversation with the user.</param>
|
||||
/// <param name="oAuthAppCredentials">AppCredentials for OAuth.</param>
|
||||
/// <param name="connectionName">The name of the Azure Active Directory connection configured with this bot.</param>
|
||||
/// <param name="resourceUrls">The list of resource URLs to retrieve tokens for.</param>
|
||||
/// <param name="userId">The user Id for which tokens are retrieved. If passing in null the userId is taken from the Activity in the ITurnContext.</param>
|
||||
/// <param name="cancellationToken">A cancellation token that can be used by other objects
|
||||
/// or threads to receive notice of cancellation.</param>
|
||||
/// <returns>Dictionary of resourceUrl to the corresponding TokenResponse.</returns>
|
||||
Task<Dictionary<string, TokenResponse>> GetAadTokensAsync(ITurnContext context, AppCredentials oAuthAppCredentials, string connectionName, string[] resourceUrls, string userId = null, CancellationToken cancellationToken = default(CancellationToken));
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves Azure Active Directory tokens for particular resources on a configured connection, using the bot's AppCredentials.
|
||||
/// </summary>
|
||||
|
|
Загрузка…
Ссылка в новой задаче