-
Notifications
You must be signed in to change notification settings - Fork 281
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
migrate c# change in for adding oauth app credentials as a parameter (#…
…1697) * migrate .net change in for adding oauth app credentials as a parameter * rename variable * change turn state key name * fix use ternary operator * use CredentialTokenProvider interface that extends UserTokenProvider interface * remove unused comments * correct the credentialTokenProvider interface path * fix import * fix the dependency chain * fix parameter name * fix comments * fix tests * fix token resolve test * fix test * make webResource interface * cleanup new interface names * rename AppCredentialsProvider to AppCredentials * add back newline Co-authored-by: Steven Ickman <stevenic@microsoft.com> Co-authored-by: Steven Gum <14935595+stevengum@users.noreply.github.com>
- Loading branch information
1 parent
05ead6e
commit 0d2a4ed
Showing
10 changed files
with
148 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/** | ||
* @module botbuilder-core | ||
*/ | ||
/** | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. | ||
*/ | ||
|
||
/** | ||
* Internal interface representing the "WebResource" from @azure/ms-rest-js@1.2.6 | ||
*/ | ||
interface WebResource {} | ||
|
||
/** | ||
* AppCredentials | ||
* @remarks | ||
* Runtime-agnostic interface representing "ServiceClientCredentials" from @azure/ms-rest-js@1.2.6 | ||
*/ | ||
export interface AppCredentials { | ||
/** | ||
* Signs a request with the Authentication header. | ||
* | ||
* @param {WebResource} webResource The WebResource/request to be signed. | ||
* @returns {Promise<WebResource>} The signed request object; | ||
*/ | ||
signRequest(webResource: WebResource): Promise<WebResource>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/** | ||
* @module botbuilder-core | ||
*/ | ||
/** | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. | ||
*/ | ||
|
||
import { AppCredentials } from './appCredentials'; | ||
import { IUserTokenProvider } from './userTokenProvider'; | ||
import { TurnContext } from './turnContext'; | ||
import { TokenResponse } from 'botframework-schema'; | ||
|
||
export interface CredentialTokenProvider extends IUserTokenProvider { | ||
/** | ||
* Retrieves the OAuth token for a user that is in a sign-in flow. | ||
* @param context Context for the current turn of conversation with the user. | ||
* @param connectionName Name of the auth connection to use. | ||
* @param magicCode (Optional) Optional user entered code to validate. | ||
*/ | ||
getUserToken(context: TurnContext, connectionName: string, magicCode?: string, appCredentials?: AppCredentials): Promise<TokenResponse>; | ||
|
||
/** | ||
* Signs the user out with the token server. | ||
* @param context Context for the current turn of conversation with the user. | ||
* @param connectionName Name of the auth connection to use. | ||
* @param userId User id of user to sign out. | ||
* @param oAuthAppCredentials AppCredentials for OAuth. | ||
*/ | ||
signOutUser(context: TurnContext, connectionName: string, userId?: string, appCredentials?: AppCredentials): Promise<void>; | ||
|
||
/** | ||
* Gets a signin link from the token server that can be sent as part of a SigninCard. | ||
* @param context Context for the current turn of conversation with the user. | ||
* @param connectionName Name of the auth connection to use. | ||
* @param oAuthAppCredentials AppCredentials for OAuth. | ||
*/ | ||
getSignInLink(context: TurnContext, connectionName: string, appCredentials?: AppCredentials): Promise<string>; | ||
|
||
/** | ||
* Signs the user out with the token server. | ||
* @param context Context for the current turn of conversation with the user. | ||
* @param connectionName Name of the auth connection to use. | ||
* @param oAuthAppCredentials AppCredentials for OAuth. | ||
*/ | ||
getAadTokens(context: TurnContext, connectionName: string, resourceUrls: string[], appCredentials?: AppCredentials): Promise<{ | ||
[propertyName: string]: TokenResponse; | ||
}>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.