@microsoft/agents-hosting 0.5.1-g2e246ff274 → 0.5.12-g2d752e9b13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/dist/src/app/adaptiveCards/adaptiveCardsActions.js +4 -4
  2. package/dist/src/app/adaptiveCards/adaptiveCardsActions.js.map +1 -1
  3. package/dist/src/app/agentApplication.js +1 -1
  4. package/dist/src/app/agentApplication.js.map +1 -1
  5. package/dist/src/app/oauth/authorization.d.ts +1 -0
  6. package/dist/src/app/oauth/authorization.js +3 -4
  7. package/dist/src/app/oauth/authorization.js.map +1 -1
  8. package/dist/src/app/streaming/citation.d.ts +25 -0
  9. package/dist/src/app/streaming/citation.js +7 -0
  10. package/dist/src/app/streaming/citation.js.map +1 -0
  11. package/dist/src/app/streaming/citationUtil.d.ts +31 -0
  12. package/dist/src/app/streaming/citationUtil.js +70 -0
  13. package/dist/src/app/streaming/citationUtil.js.map +1 -0
  14. package/dist/src/app/streaming/streamingResponse.d.ts +140 -0
  15. package/dist/src/app/streaming/streamingResponse.js +333 -0
  16. package/dist/src/app/streaming/streamingResponse.js.map +1 -0
  17. package/dist/src/cards/cardFactory.d.ts +2 -2
  18. package/dist/src/cards/cardFactory.js.map +1 -1
  19. package/dist/src/oauth/index.d.ts +1 -4
  20. package/dist/src/oauth/index.js +1 -4
  21. package/dist/src/oauth/index.js.map +1 -1
  22. package/dist/src/oauth/oAuthFlow.d.ts +9 -10
  23. package/dist/src/oauth/oAuthFlow.js +35 -38
  24. package/dist/src/oauth/oAuthFlow.js.map +1 -1
  25. package/dist/src/oauth/userTokenClient.d.ts +37 -7
  26. package/dist/src/oauth/userTokenClient.js +56 -15
  27. package/dist/src/oauth/userTokenClient.js.map +1 -1
  28. package/dist/src/oauth/userTokenClient.types.d.ts +147 -0
  29. package/dist/src/oauth/{signingResource.js → userTokenClient.types.js} +1 -1
  30. package/dist/src/oauth/userTokenClient.types.js.map +1 -0
  31. package/dist/src/turnContext.d.ts +3 -0
  32. package/dist/src/turnContext.js +5 -0
  33. package/dist/src/turnContext.js.map +1 -1
  34. package/package.json +3 -3
  35. package/src/app/adaptiveCards/adaptiveCardsActions.ts +4 -4
  36. package/src/app/agentApplication.ts +1 -1
  37. package/src/app/oauth/authorization.ts +6 -8
  38. package/src/app/streaming/citation.ts +29 -0
  39. package/src/app/streaming/citationUtil.ts +76 -0
  40. package/src/app/streaming/streamingResponse.ts +407 -0
  41. package/src/cards/cardFactory.ts +2 -3
  42. package/src/oauth/index.ts +1 -4
  43. package/src/oauth/oAuthFlow.ts +39 -45
  44. package/src/oauth/userTokenClient.ts +62 -19
  45. package/src/oauth/userTokenClient.types.ts +173 -0
  46. package/src/turnContext.ts +7 -1
  47. package/dist/src/oauth/oAuthCard.d.ts +0 -27
  48. package/dist/src/oauth/oAuthCard.js +0 -5
  49. package/dist/src/oauth/oAuthCard.js.map +0 -1
  50. package/dist/src/oauth/signingResource.d.ts +0 -43
  51. package/dist/src/oauth/signingResource.js.map +0 -1
  52. package/dist/src/oauth/tokenExchangeRequest.d.ts +0 -17
  53. package/dist/src/oauth/tokenExchangeRequest.js +0 -5
  54. package/dist/src/oauth/tokenExchangeRequest.js.map +0 -1
  55. package/dist/src/oauth/tokenResponse.d.ts +0 -29
  56. package/dist/src/oauth/tokenResponse.js +0 -25
  57. package/dist/src/oauth/tokenResponse.js.map +0 -1
  58. package/src/oauth/oAuthCard.ts +0 -30
  59. package/src/oauth/signingResource.ts +0 -48
  60. package/src/oauth/tokenExchangeRequest.ts +0 -20
  61. package/src/oauth/tokenResponse.ts +0 -43
@@ -2,12 +2,10 @@
2
2
  // Licensed under the MIT License.
3
3
 
4
4
  import axios, { AxiosInstance } from 'axios'
5
- import { SigningResource } from './signingResource'
6
5
  import { ConversationReference } from '@microsoft/agents-activity'
7
6
  import { debug } from '../logger'
8
- import { TokenExchangeRequest } from './tokenExchangeRequest'
9
7
  import { normalizeTokenExchangeState } from '../activityWireCompat'
10
- import { TokenRequestStatus, TokenResponse } from './tokenResponse'
8
+ import { AadResourceUrls, SignInResource, TokenExchangeRequest, TokenOrSinginResourceResponse, TokenResponse, TokenStatus } from './userTokenClient.types'
11
9
  import { getProductInfo } from '../getProductInfo'
12
10
 
13
11
  const logger = debug('agents:user-token-client')
@@ -17,12 +15,14 @@ const logger = debug('agents:user-token-client')
17
15
  */
18
16
  export class UserTokenClient {
19
17
  client: AxiosInstance
20
-
18
+ msAppId: string
21
19
  /**
22
20
  * Creates a new instance of UserTokenClient.
23
21
  * @param token The token to use for authentication.
22
+ * @param msAppId The Microsoft application ID.
24
23
  */
25
- constructor (token: string) {
24
+ constructor (token: string, appId: string) {
25
+ this.msAppId = appId
26
26
  const baseURL = 'https://api.botframework.com'
27
27
  const axiosInstance = axios.create({
28
28
  baseURL,
@@ -47,15 +47,12 @@ export class UserTokenClient {
47
47
  try {
48
48
  const params = { connectionName, channelId, userId, code }
49
49
  const response = await this.client.get('/api/usertoken/GetToken', { params })
50
- return { ...response.data, status: TokenRequestStatus.Success }
50
+ return response.data as TokenResponse
51
51
  } catch (error: any) {
52
52
  if (error.response?.status !== 404) {
53
53
  logger.error(error)
54
54
  }
55
- return {
56
- status: TokenRequestStatus.Failed,
57
- token: undefined
58
- }
55
+ return { token: undefined }
59
56
  }
60
57
  }
61
58
 
@@ -81,24 +78,24 @@ export class UserTokenClient {
81
78
 
82
79
  /**
83
80
  * Gets the sign-in resource.
84
- * @param appId The application ID.
85
- * @param cnxName The connection name.
81
+ * @param msAppId The application ID.
82
+ * @param connectionName The connection name.
86
83
  * @param activity The activity.
87
84
  * @returns A promise that resolves to the signing resource.
88
85
  */
89
- async getSignInResource (appId: string, cnxName: string, conversationReference: ConversationReference, relatesTo?: ConversationReference) : Promise<SigningResource> {
86
+ async getSignInResource (msAppId: string, connectionName: string, conversation: ConversationReference, relatesTo?: ConversationReference) : Promise<SignInResource> {
90
87
  try {
91
88
  const tokenExchangeState = {
92
- connectionName: cnxName,
93
- conversation: conversationReference,
89
+ connectionName,
90
+ conversation,
94
91
  relatesTo,
95
- msAppId: appId
92
+ msAppId
96
93
  }
97
94
  const tokenExchangeStateNormalized = normalizeTokenExchangeState(tokenExchangeState)
98
95
  const state = Buffer.from(JSON.stringify(tokenExchangeStateNormalized)).toString('base64')
99
96
  const params = { state }
100
97
  const response = await this.client.get('/api/botsignin/GetSignInResource', { params })
101
- return response.data as SigningResource
98
+ return response.data as SignInResource
102
99
  } catch (error: any) {
103
100
  logger.error(error)
104
101
  throw error
@@ -117,10 +114,56 @@ export class UserTokenClient {
117
114
  try {
118
115
  const params = { userId, connectionName, channelId }
119
116
  const response = await this.client.post('/api/usertoken/exchange', tokenExchangeRequest, { params })
120
- return { ...response.data, status: TokenRequestStatus.Success }
117
+ return response.data as TokenResponse
121
118
  } catch (error: any) {
122
119
  logger.error(error)
123
- return { status: TokenRequestStatus.Failed, token: undefined }
120
+ return { token: undefined }
124
121
  }
125
122
  }
123
+
124
+ /**
125
+ * Gets the token or sign-in resource.
126
+ * @param userId The user ID.
127
+ * @param connectionName The connection name.
128
+ * @param channelId The channel ID.
129
+ * @param conversation The conversation reference.
130
+ * @param relatesTo The related conversation reference.
131
+ * @param code The code.
132
+ * @param finalRedirect The final redirect URL.
133
+ * @param fwdUrl The forward URL.
134
+ * @returns A promise that resolves to the token or sign-in resource response.
135
+ */
136
+ async getTokenOrSignInResource (userId: string, connectionName: string, channelId: string, conversation: ConversationReference, relatesTo: ConversationReference, code: string, finalRedirect: string = '', fwdUrl: string = '') : Promise<TokenOrSinginResourceResponse> {
137
+ const state = Buffer.from(JSON.stringify({ conversation, relatesTo, connectionName, msAppId: this.msAppId })).toString('base64')
138
+ const params = { userId, connectionName, channelId, state, code, finalRedirect, fwdUrl }
139
+ const response = await this.client.get('/api/usertoken/GetTokenOrSignInResource', { params })
140
+ return response.data as TokenOrSinginResourceResponse
141
+ }
142
+
143
+ /**
144
+ * Gets the token status.
145
+ * @param userId The user ID.
146
+ * @param channelId The channel ID.
147
+ * @param include The optional include parameter.
148
+ * @returns A promise that resolves to the token status.
149
+ */
150
+ async getTokenStatus (userId: string, channelId: string, include: string = null!): Promise<TokenStatus[]> {
151
+ const params = { userId, channelId, include }
152
+ const response = await this.client.get('/api/usertoken/GetTokenStatus', { params })
153
+ return response.data as TokenStatus[]
154
+ }
155
+
156
+ /**
157
+ * Gets the AAD tokens.
158
+ * @param userId The user ID.
159
+ * @param connectionName The connection name.
160
+ * @param channelId The channel ID.
161
+ * @param resourceUrls The resource URLs.
162
+ * @returns A promise that resolves to the AAD tokens.
163
+ */
164
+ async getAadTokens (userId: string, connectionName: string, channelId: string, resourceUrls: AadResourceUrls) : Promise<Record<string, TokenResponse>> {
165
+ const params = { userId, connectionName, channelId }
166
+ const response = await this.client.post('/api/usertoken/GetAadTokens', resourceUrls, { params })
167
+ return response.data as Record<string, TokenResponse>
168
+ }
126
169
  }
@@ -0,0 +1,173 @@
1
+ // Copyright (c) Microsoft Corporation. All rights reserved.
2
+ // Licensed under the MIT License.
3
+
4
+ import { CardAction } from '@microsoft/agents-activity'
5
+
6
+ /**
7
+ * Represents the response containing OAuth token information.
8
+ * This interface encapsulates all data related to an OAuth token response.
9
+ */
10
+ export interface TokenResponse {
11
+ /**
12
+ * The OAuth token string, or undefined if no token is available.
13
+ */
14
+ token: string | undefined;
15
+ }
16
+
17
+ /**
18
+ * Represents a request for exchanging tokens.
19
+ * This interface defines the structure of a token exchange request, including the URI, token, and ID.
20
+ */
21
+ export interface TokenExchangeRequest {
22
+ /**
23
+ * The URI for the token exchange request.
24
+ */
25
+ uri?: string;
26
+
27
+ /**
28
+ * The token to be exchanged.
29
+ */
30
+ token?: string;
31
+
32
+ /**
33
+ * The ID associated with the token exchange request.
34
+ */
35
+ id?: string;
36
+ }
37
+
38
+ /**
39
+ * Represents a resource for exchanging tokens.
40
+ * This interface defines the structure of a token exchange resource, including its ID, URI, and provider ID.
41
+ */
42
+ export interface TokenExchangeResource {
43
+ /**
44
+ * The ID of the token exchange resource.
45
+ */
46
+ id?: string;
47
+
48
+ /**
49
+ * The URI of the token exchange resource.
50
+ */
51
+ uri?: string;
52
+
53
+ /**
54
+ * The provider ID for the token exchange resource.
55
+ */
56
+ providerId?: string;
57
+ }
58
+
59
+ /**
60
+ * Represents a resource for posting tokens.
61
+ * This interface defines the structure of a token post resource, including its SAS URL.
62
+ */
63
+ export interface TokenPostResource {
64
+ /**
65
+ * The SAS URL for the token post resource.
66
+ */
67
+ sasUrl?: string;
68
+ }
69
+
70
+ /**
71
+ * Represents a resource for signing in.
72
+ * This interface defines the structure of a sign-in resource, including the sign-in link, token exchange resource, and token post resource.
73
+ */
74
+ export interface SignInResource {
75
+ /**
76
+ * The link for signing in.
77
+ */
78
+ signInLink: string;
79
+
80
+ /**
81
+ * The resource for token exchange.
82
+ */
83
+ tokenExchangeResource: TokenExchangeResource;
84
+
85
+ /**
86
+ * The resource for token post.
87
+ */
88
+ tokenPostResource: TokenPostResource;
89
+ }
90
+
91
+ /**
92
+ * Represents an OAuth card.
93
+ * This interface defines the structure of an OAuth card, including its buttons, connection name, text, and associated resources.
94
+ */
95
+ export interface OAuthCard {
96
+ /**
97
+ * The buttons associated with the OAuth card.
98
+ */
99
+ buttons: CardAction[];
100
+
101
+ /**
102
+ * The connection name for the OAuth card.
103
+ */
104
+ connectionName: string;
105
+
106
+ /**
107
+ * The text content of the OAuth card.
108
+ */
109
+ text: string;
110
+
111
+ /**
112
+ * The token exchange resource for the OAuth card.
113
+ */
114
+ tokenExchangeResource: TokenExchangeResource;
115
+
116
+ /**
117
+ * The token post resource for the OAuth card.
118
+ */
119
+ tokenPostResource: TokenPostResource;
120
+ }
121
+
122
+ /**
123
+ * Represents a response containing either a token or a sign-in resource.
124
+ * This interface defines the structure of a response that includes a token response and a sign-in resource.
125
+ */
126
+ export interface TokenOrSinginResourceResponse {
127
+ /**
128
+ * The token response containing OAuth token information.
129
+ */
130
+ tokenResponse: TokenResponse;
131
+
132
+ /**
133
+ * The sign-in resource containing sign-in and token exchange information.
134
+ */
135
+ signInResource: SignInResource;
136
+ }
137
+
138
+ /**
139
+ * Represents the status of a token.
140
+ * This interface defines the structure of a token status, including channel ID, connection name, and other metadata.
141
+ */
142
+ export interface TokenStatus {
143
+ /**
144
+ * The ID of the channel associated with the token.
145
+ */
146
+ channelId: string;
147
+
148
+ /**
149
+ * The connection name associated with the token.
150
+ */
151
+ connectionName: string;
152
+
153
+ /**
154
+ * Indicates whether a token is available.
155
+ */
156
+ hasToken: boolean;
157
+
158
+ /**
159
+ * The display name of the service provider.
160
+ */
161
+ serviceProviderDisplayName: string;
162
+ }
163
+
164
+ /**
165
+ * Represents a collection of Azure Active Directory (AAD) resource URLs.
166
+ * This interface defines the structure of a collection of resource URLs.
167
+ */
168
+ export interface AadResourceUrls {
169
+ /**
170
+ * An array of resource URLs.
171
+ */
172
+ resourceUrls: string[];
173
+ }
@@ -6,6 +6,7 @@ import { ResourceResponse } from './connector-client/resourceResponse'
6
6
  import { TurnContextStateCollection } from './turnContextStateCollection'
7
7
  import { AttachmentInfo } from './connector-client/attachmentInfo'
8
8
  import { AttachmentData } from './connector-client/attachmentData'
9
+ import { StreamingResponse } from './app/streaming/streamingResponse'
9
10
 
10
11
  /**
11
12
  * Defines a handler for processing and sending activities.
@@ -73,7 +74,7 @@ export class TurnContext {
73
74
  private readonly _onDeleteActivity: DeleteActivityHandler[] = []
74
75
  private readonly _turn = 'turn'
75
76
  private readonly _locale = 'locale'
76
-
77
+ private readonly _streamingResponse: StreamingResponse
77
78
  /**
78
79
  * Initializes a new instance of the TurnContext class.
79
80
  *
@@ -89,6 +90,7 @@ export class TurnContext {
89
90
  this._adapter = adapterOrContext
90
91
  this._activity = request as Activity
91
92
  }
93
+ this._streamingResponse = new StreamingResponse(this)
92
94
  }
93
95
 
94
96
  /**
@@ -395,6 +397,10 @@ export class TurnContext {
395
397
  return this._turnState
396
398
  }
397
399
 
400
+ get streamingResponse (): StreamingResponse {
401
+ return this._streamingResponse
402
+ }
403
+
398
404
  /**
399
405
  * Emits events to registered middleware handlers.
400
406
  *
@@ -1,27 +0,0 @@
1
- import { CardAction } from '@microsoft/agents-activity';
2
- import { TokenExchangeResource, TokenPostResource } from './signingResource';
3
- /**
4
- * Represents an OAuth card.
5
- */
6
- export interface OAuthCard {
7
- /**
8
- * The buttons associated with the OAuth card.
9
- */
10
- buttons: CardAction[];
11
- /**
12
- * The connection name for the OAuth card.
13
- */
14
- connectionName: string;
15
- /**
16
- * The text content of the OAuth card.
17
- */
18
- text: string;
19
- /**
20
- * The token exchange resource for the OAuth card.
21
- */
22
- tokenExchangeResource: TokenExchangeResource;
23
- /**
24
- * The token post resource for the OAuth card.
25
- */
26
- tokenPostResource: TokenPostResource;
27
- }
@@ -1,5 +0,0 @@
1
- "use strict";
2
- // Copyright (c) Microsoft Corporation. All rights reserved.
3
- // Licensed under the MIT License.
4
- Object.defineProperty(exports, "__esModule", { value: true });
5
- //# sourceMappingURL=oAuthCard.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"oAuthCard.js","sourceRoot":"","sources":["../../../src/oauth/oAuthCard.ts"],"names":[],"mappings":";AAAA,4DAA4D;AAC5D,kCAAkC"}
@@ -1,43 +0,0 @@
1
- /**
2
- * Represents a resource for exchanging tokens.
3
- */
4
- export interface TokenExchangeResource {
5
- /**
6
- * The ID of the token exchange resource.
7
- */
8
- id?: string;
9
- /**
10
- * The URI of the token exchange resource.
11
- */
12
- uri?: string;
13
- /**
14
- * The provider ID for the token exchange resource.
15
- */
16
- providerId?: string;
17
- }
18
- /**
19
- * Represents a resource for posting tokens.
20
- */
21
- export interface TokenPostResource {
22
- /**
23
- * The SAS URL for the token post resource.
24
- */
25
- sasUrl?: string;
26
- }
27
- /**
28
- * Represents a resource for signing in.
29
- */
30
- export interface SigningResource {
31
- /**
32
- * The link for signing in.
33
- */
34
- signInLink: string;
35
- /**
36
- * The resource for token exchange.
37
- */
38
- tokenExchangeResource: TokenExchangeResource;
39
- /**
40
- * The resource for token post.
41
- */
42
- tokenPostResource: TokenPostResource;
43
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"signingResource.js","sourceRoot":"","sources":["../../../src/oauth/signingResource.ts"],"names":[],"mappings":";AAAA,4DAA4D;AAC5D,kCAAkC"}
@@ -1,17 +0,0 @@
1
- /**
2
- * Represents a request for exchanging tokens.
3
- */
4
- export interface TokenExchangeRequest {
5
- /**
6
- * The URI for the token exchange request.
7
- */
8
- uri?: string;
9
- /**
10
- * The token to be exchanged.
11
- */
12
- token?: string;
13
- /**
14
- * The ID associated with the token exchange request.
15
- */
16
- id?: string;
17
- }
@@ -1,5 +0,0 @@
1
- "use strict";
2
- // Copyright (c) Microsoft Corporation. All rights reserved.
3
- // Licensed under the MIT License.
4
- Object.defineProperty(exports, "__esModule", { value: true });
5
- //# sourceMappingURL=tokenExchangeRequest.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tokenExchangeRequest.js","sourceRoot":"","sources":["../../../src/oauth/tokenExchangeRequest.ts"],"names":[],"mappings":";AAAA,4DAA4D;AAC5D,kCAAkC"}
@@ -1,29 +0,0 @@
1
- /**
2
- * Represents the status of an OAuth token request.
3
- */
4
- export declare enum TokenRequestStatus {
5
- /**
6
- * Indicates that the token request was successful.
7
- */
8
- Success = "Success",
9
- /**
10
- * Indicates that the token request failed.
11
- */
12
- Failed = "Failed",
13
- /**
14
- * Indicates that the token request is pending.
15
- */
16
- InProgress = "InProgress",
17
- Expired = "Expired"
18
- }
19
- /**
20
- * Represents the response containing OAuth token information.
21
- * This interface encapsulates all data related to an OAuth token response.
22
- */
23
- export interface TokenResponse {
24
- status: TokenRequestStatus;
25
- /**
26
- * The OAuth token string, or null if no token is available.
27
- */
28
- token: string | undefined;
29
- }
@@ -1,25 +0,0 @@
1
- "use strict";
2
- // Copyright (c) Microsoft Corporation. All rights reserved.
3
- // Licensed under the MIT License.
4
- Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.TokenRequestStatus = void 0;
6
- /**
7
- * Represents the status of an OAuth token request.
8
- */
9
- var TokenRequestStatus;
10
- (function (TokenRequestStatus) {
11
- /**
12
- * Indicates that the token request was successful.
13
- */
14
- TokenRequestStatus["Success"] = "Success";
15
- /**
16
- * Indicates that the token request failed.
17
- */
18
- TokenRequestStatus["Failed"] = "Failed";
19
- /**
20
- * Indicates that the token request is pending.
21
- */
22
- TokenRequestStatus["InProgress"] = "InProgress";
23
- TokenRequestStatus["Expired"] = "Expired";
24
- })(TokenRequestStatus || (exports.TokenRequestStatus = TokenRequestStatus = {}));
25
- //# sourceMappingURL=tokenResponse.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tokenResponse.js","sourceRoot":"","sources":["../../../src/oauth/tokenResponse.ts"],"names":[],"mappings":";AAAA,4DAA4D;AAC5D,kCAAkC;;;AAElC;;GAEG;AACH,IAAY,kBAiBX;AAjBD,WAAY,kBAAkB;IAC5B;;OAEG;IACH,yCAAmB,CAAA;IAEnB;;OAEG;IACH,uCAAiB,CAAA;IAEjB;;OAEG;IACH,+CAAyB,CAAA;IAEzB,yCAAmB,CAAA;AACrB,CAAC,EAjBW,kBAAkB,kCAAlB,kBAAkB,QAiB7B"}
@@ -1,30 +0,0 @@
1
- // Copyright (c) Microsoft Corporation. All rights reserved.
2
- // Licensed under the MIT License.
3
-
4
- import { CardAction } from '@microsoft/agents-activity'
5
- import { TokenExchangeResource, TokenPostResource } from './signingResource'
6
- /**
7
- * Represents an OAuth card.
8
- */
9
- export interface OAuthCard {
10
- /**
11
- * The buttons associated with the OAuth card.
12
- */
13
- buttons: CardAction[]
14
- /**
15
- * The connection name for the OAuth card.
16
- */
17
- connectionName: string
18
- /**
19
- * The text content of the OAuth card.
20
- */
21
- text: string
22
- /**
23
- * The token exchange resource for the OAuth card.
24
- */
25
- tokenExchangeResource: TokenExchangeResource
26
- /**
27
- * The token post resource for the OAuth card.
28
- */
29
- tokenPostResource: TokenPostResource
30
- }
@@ -1,48 +0,0 @@
1
- // Copyright (c) Microsoft Corporation. All rights reserved.
2
- // Licensed under the MIT License.
3
-
4
- /**
5
- * Represents a resource for exchanging tokens.
6
- */
7
- export interface TokenExchangeResource {
8
- /**
9
- * The ID of the token exchange resource.
10
- */
11
- id?: string
12
- /**
13
- * The URI of the token exchange resource.
14
- */
15
- uri?: string
16
- /**
17
- * The provider ID for the token exchange resource.
18
- */
19
- providerId?: string
20
- }
21
-
22
- /**
23
- * Represents a resource for posting tokens.
24
- */
25
- export interface TokenPostResource {
26
- /**
27
- * The SAS URL for the token post resource.
28
- */
29
- sasUrl?: string
30
- }
31
-
32
- /**
33
- * Represents a resource for signing in.
34
- */
35
- export interface SigningResource {
36
- /**
37
- * The link for signing in.
38
- */
39
- signInLink: string,
40
- /**
41
- * The resource for token exchange.
42
- */
43
- tokenExchangeResource: TokenExchangeResource,
44
- /**
45
- * The resource for token post.
46
- */
47
- tokenPostResource: TokenPostResource
48
- }
@@ -1,20 +0,0 @@
1
- // Copyright (c) Microsoft Corporation. All rights reserved.
2
- // Licensed under the MIT License.
3
-
4
- /**
5
- * Represents a request for exchanging tokens.
6
- */
7
- export interface TokenExchangeRequest {
8
- /**
9
- * The URI for the token exchange request.
10
- */
11
- uri?: string
12
- /**
13
- * The token to be exchanged.
14
- */
15
- token?: string
16
- /**
17
- * The ID associated with the token exchange request.
18
- */
19
- id?: string
20
- }
@@ -1,43 +0,0 @@
1
- // Copyright (c) Microsoft Corporation. All rights reserved.
2
- // Licensed under the MIT License.
3
-
4
- /**
5
- * Represents the status of an OAuth token request.
6
- */
7
- export enum TokenRequestStatus {
8
- /**
9
- * Indicates that the token request was successful.
10
- */
11
- Success = 'Success',
12
-
13
- /**
14
- * Indicates that the token request failed.
15
- */
16
- Failed = 'Failed',
17
-
18
- /**
19
- * Indicates that the token request is pending.
20
- */
21
- InProgress = 'InProgress',
22
-
23
- Expired = 'Expired',
24
- }
25
-
26
- /**
27
- * Represents the response containing OAuth token information.
28
- * This interface encapsulates all data related to an OAuth token response.
29
- */
30
- export interface TokenResponse {
31
-
32
- status: TokenRequestStatus
33
-
34
- /**
35
- * The OAuth token string, or null if no token is available.
36
- */
37
- token: string | undefined
38
-
39
- /**
40
- * The expiration time of the token, represented as a numeric timestamp.
41
- */
42
- // expires: number
43
- }