Skip to content

Commit 9a5dd0d

Browse files
authored
Support for Bot Framework Auth v3.2 (#3543)
* Support for Bot Framework Auth v3.2 This auth change supports the future move from an independent AAD tenant to the Microsoft Services tenant. This will result in new issuer values being sent and returned, primarily from the emulator code paths. As part of this change, the bot builder version numbers were normalized to 3.10.5. * Removing support for Bot Framework security protocol v3.0 These are now depricated endpoints.
1 parent 46eb89b commit 9a5dd0d

File tree

12 files changed

+121
-122
lines changed

12 files changed

+121
-122
lines changed

CSharp/Library/Microsoft.Bot.Builder.Autofac/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@
3232
// You can specify all the values or you can default the Build and Revision Numbers
3333
// by using the '*' as shown below:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("3.9.1.0")]
36-
[assembly: AssemblyFileVersion("3.9.1.0")]
35+
[assembly: AssemblyVersion("3.10.5.0")]
36+
[assembly: AssemblyFileVersion("3.10.5.0")]
3737

3838
[assembly: InternalsVisibleTo("Microsoft.Bot.Builder.Tests")]
3939
[assembly: InternalsVisibleTo("Microsoft.Bot.Sample.Tests")]

CSharp/Library/Microsoft.Bot.Builder/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
// You can specify all the values or you can default the Build and Revision Numbers
3434
// by using the '*' as shown below:
3535
// [assembly: AssemblyVersion("1.0.*")]
36-
[assembly: AssemblyVersion("3.9.1.0")]
37-
[assembly: AssemblyFileVersion("3.9.1.0")]
36+
[assembly: AssemblyVersion("3.10.5.0")]
37+
[assembly: AssemblyFileVersion("3.10.5.0")]
3838

3939
[assembly: InternalsVisibleTo("Microsoft.Bot.Builder.Tests")]
4040
[assembly: InternalsVisibleTo("Microsoft.Bot.Sample.Tests")]

CSharp/Library/Microsoft.Bot.Connector.NetFramework/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,5 @@
3030
//
3131
// You can specify all the values or you can default the Build and Revision Numbers
3232
// by using the '*' as shown below:
33-
[assembly: AssemblyVersion("3.9.1.0")]
34-
[assembly: AssemblyFileVersion("3.9.1.0")]
33+
[assembly: AssemblyVersion("3.10.5.0")]
34+
[assembly: AssemblyFileVersion("3.10.5.0")]

CSharp/Library/Microsoft.Bot.Connector.Shared/JwtConfig.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,12 @@ public static class JwtConfig
5959
new TokenValidationParameters()
6060
{
6161
ValidateIssuer = true,
62-
ValidIssuers = new[] { "https://sts.windows.net/72f988bf-86f1-41af-91ab-2d7cd011db47/", "https://sts.windows.net/d6d49420-f39b-4df7-a1dc-d59a935871db/", "https://login.microsoftonline.com/d6d49420-f39b-4df7-a1dc-d59a935871db/v2.0" },
62+
ValidIssuers = new[] {
63+
"https://sts.windows.net/d6d49420-f39b-4df7-a1dc-d59a935871db/", // Auth v3.1, 1.0 token
64+
"https://login.microsoftonline.com/d6d49420-f39b-4df7-a1dc-d59a935871db/v2.0", // Auth v3.1, 2.0 token
65+
"https://sts.windows.net/f8cdef31-a31e-4b4a-93e4-5f571e91255a/", // Auth v3.2, 1.0 token
66+
"https://login.microsoftonline.com/f8cdef31-a31e-4b4a-93e4-5f571e91255a/v2.0" // Auth v3.2, 2.0 token
67+
},
6368
// Audience validation takes place in JwtTokenExtractor
6469
ValidateAudience = false,
6570
ValidateLifetime = true,

CSharp/Library/Microsoft.Bot.Connector.Shared/JwtTokenExtractor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ public string GetAppIdFromEmulatorClaimsIdentity(ClaimsIdentity identity)
173173
if (appIdClaim == null)
174174
return null;
175175

176-
// v3.1 emulator token
176+
// v3.1 or v3.2 emulator token
177177
if (identity.Claims.Any(c => c.Type == "aud" && c.Value == appIdClaim.Value))
178178
return appIdClaim.Value;
179179

Node/core/lib/bots/ChatConnector.js

Lines changed: 35 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,16 @@ var ChatConnector = (function () {
2323
botConnectorOpenIdMetadata: this.settings.openIdMetadata || 'https://login.botframework.com/v1/.well-known/openidconfiguration',
2424
botConnectorIssuer: 'https://api.botframework.com',
2525
botConnectorAudience: this.settings.appId,
26-
msaOpenIdMetadata: 'https://login.microsoftonline.com/common/v2.0/.well-known/openid-configuration',
27-
msaIssuer: 'https://sts.windows.net/72f988bf-86f1-41af-91ab-2d7cd011db47/',
28-
msaAudience: 'https://graph.microsoft.com',
2926
emulatorOpenIdMetadata: 'https://login.microsoftonline.com/botframework.com/v2.0/.well-known/openid-configuration',
3027
emulatorAudience: this.settings.appId,
31-
emulatorIssuerV1: 'https://sts.windows.net/d6d49420-f39b-4df7-a1dc-d59a935871db/',
32-
emulatorIssuerV2: 'https://login.microsoftonline.com/d6d49420-f39b-4df7-a1dc-d59a935871db/v2.0',
28+
emulatorAuthV31IssuerV1: 'https://sts.windows.net/d6d49420-f39b-4df7-a1dc-d59a935871db/',
29+
emulatorAuthV31IssuerV2: 'https://login.microsoftonline.com/d6d49420-f39b-4df7-a1dc-d59a935871db/v2.0',
30+
emulatorAuthV32IssuerV1: 'https://sts.windows.net/f8cdef31-a31e-4b4a-93e4-5f571e91255a/',
31+
emulatorAuthV32IssuerV2: 'https://login.microsoftonline.com/f8cdef31-a31e-4b4a-93e4-5f571e91255a/v2.0',
3332
stateEndpoint: this.settings.stateEndpoint || 'https://state.botframework.com'
3433
};
3534
}
3635
this.botConnectorOpenIdMetadata = new OpenIdMetadata_1.OpenIdMetadata(this.settings.endpoint.botConnectorOpenIdMetadata);
37-
this.msaOpenIdMetadata = new OpenIdMetadata_1.OpenIdMetadata(this.settings.endpoint.msaOpenIdMetadata);
3836
this.emulatorOpenIdMetadata = new OpenIdMetadata_1.OpenIdMetadata(this.settings.endpoint.emulatorOpenIdMetadata);
3937
}
4038
ChatConnector.prototype.listen = function () {
@@ -71,48 +69,45 @@ var ChatConnector = (function () {
7169
var verifyOptions;
7270
var openIdMetadata;
7371
var algorithms = ['RS256', 'RS384', 'RS512'];
74-
if (isEmulator && decoded_1.payload.iss == this.settings.endpoint.msaIssuer) {
75-
openIdMetadata = this.msaOpenIdMetadata;
76-
verifyOptions = {
77-
algorithms: algorithms,
78-
issuer: this.settings.endpoint.msaIssuer,
79-
audience: this.settings.endpoint.msaAudience,
80-
clockTolerance: 300
81-
};
82-
}
83-
else if (isEmulator && decoded_1.payload.ver === '1.0' && decoded_1.payload.iss == this.settings.endpoint.emulatorIssuerV1) {
84-
openIdMetadata = this.emulatorOpenIdMetadata;
85-
verifyOptions = {
86-
algorithms: algorithms,
87-
issuer: this.settings.endpoint.emulatorIssuerV1,
88-
audience: this.settings.endpoint.emulatorAudience,
89-
clockTolerance: 300
90-
};
91-
}
92-
else if (isEmulator && decoded_1.payload.ver === '2.0' && decoded_1.payload.iss == this.settings.endpoint.emulatorIssuerV2) {
93-
openIdMetadata = this.emulatorOpenIdMetadata;
94-
verifyOptions = {
95-
algorithms: algorithms,
96-
issuer: this.settings.endpoint.emulatorIssuerV2,
97-
audience: this.settings.endpoint.emulatorAudience,
98-
clockTolerance: 300
99-
};
72+
if (isEmulator) {
73+
if ((decoded_1.payload.ver === '2.0' && decoded_1.payload.azp !== this.settings.appId) ||
74+
(decoded_1.payload.ver !== '2.0' && decoded_1.payload.appid !== this.settings.appId)) {
75+
logger.error('ChatConnector: receive - invalid token. Requested by unexpected app ID.');
76+
res.status(403);
77+
res.end();
78+
return;
79+
}
80+
var issuer = void 0;
81+
if (decoded_1.payload.ver === '1.0' && decoded_1.payload.iss == this.settings.endpoint.emulatorAuthV31IssuerV1) {
82+
issuer = this.settings.endpoint.emulatorAuthV31IssuerV1;
83+
}
84+
else if (decoded_1.payload.ver === '2.0' && decoded_1.payload.iss == this.settings.endpoint.emulatorAuthV31IssuerV2) {
85+
issuer = this.settings.endpoint.emulatorAuthV31IssuerV2;
86+
}
87+
else if (decoded_1.payload.ver === '1.0' && decoded_1.payload.iss == this.settings.endpoint.emulatorAuthV32IssuerV1) {
88+
issuer = this.settings.endpoint.emulatorAuthV32IssuerV1;
89+
}
90+
else if (decoded_1.payload.ver === '2.0' && decoded_1.payload.iss == this.settings.endpoint.emulatorAuthV32IssuerV2) {
91+
issuer = this.settings.endpoint.emulatorAuthV32IssuerV2;
92+
}
93+
if (issuer) {
94+
openIdMetadata = this.emulatorOpenIdMetadata;
95+
verifyOptions = {
96+
algorithms: algorithms,
97+
issuer: issuer,
98+
audience: this.settings.endpoint.emulatorAudience,
99+
clockTolerance: 300
100+
};
101+
}
100102
}
101-
else {
103+
if (!verifyOptions) {
102104
openIdMetadata = this.botConnectorOpenIdMetadata;
103105
verifyOptions = {
104106
issuer: this.settings.endpoint.botConnectorIssuer,
105107
audience: this.settings.endpoint.botConnectorAudience,
106108
clockTolerance: 300
107109
};
108110
}
109-
if (isEmulator && ((decoded_1.payload.ver === '2.0' && decoded_1.payload.azp !== this.settings.appId) ||
110-
(decoded_1.payload.ver !== '2.0' && decoded_1.payload.appid !== this.settings.appId))) {
111-
logger.error('ChatConnector: receive - invalid token. Requested by unexpected app ID.');
112-
res.status(403);
113-
res.end();
114-
return;
115-
}
116111
openIdMetadata.getKey(decoded_1.header.kid, function (key) {
117112
if (key) {
118113
try {

Node/core/lib/bots/Library.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -471,13 +471,13 @@ var Library = (function (_super) {
471471
Library.prototype.logPrefix = function () {
472472
return 'Library("' + this.name + '")';
473473
};
474-
Library.RouteTypes = {
475-
GlobalAction: 'GlobalAction',
476-
StackAction: 'StackAction',
477-
ActiveDialog: 'ActiveDialog'
478-
};
479474
return Library;
480475
}(events_1.EventEmitter));
476+
Library.RouteTypes = {
477+
GlobalAction: 'GlobalAction',
478+
StackAction: 'StackAction',
479+
ActiveDialog: 'ActiveDialog'
480+
};
481481
exports.Library = Library;
482482
exports.systemLib = new Library(consts.Library.system);
483483
exports.systemLib.localePath(path.join(__dirname, '../locale/'));

Node/core/lib/deprecated/LegacyPrompts.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -249,19 +249,19 @@ var LegacyPrompts = (function (_super) {
249249
}
250250
}
251251
};
252-
LegacyPrompts.options = {
253-
recognizer: new SimplePromptRecognizer(),
254-
promptAfterAction: true
255-
};
256-
LegacyPrompts.defaultRetryPrompt = {
257-
text: "default_text",
258-
number: "default_number",
259-
confirm: "default_confirm",
260-
choice: "default_choice",
261-
time: "default_time",
262-
attachment: "default_file"
263-
};
264252
return LegacyPrompts;
265253
}(Dialog_1.Dialog));
254+
LegacyPrompts.options = {
255+
recognizer: new SimplePromptRecognizer(),
256+
promptAfterAction: true
257+
};
258+
LegacyPrompts.defaultRetryPrompt = {
259+
text: "default_text",
260+
number: "default_number",
261+
confirm: "default_confirm",
262+
choice: "default_choice",
263+
time: "default_time",
264+
attachment: "default_file"
265+
};
266266
exports.LegacyPrompts = LegacyPrompts;
267267
Library_1.systemLib.dialog('BotBuilder:Prompts', new LegacyPrompts());

Node/core/lib/dialogs/EntityRecognizer.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -211,11 +211,11 @@ var EntityRecognizer = (function () {
211211
return [choices.toString()];
212212
}
213213
};
214-
EntityRecognizer.dateExp = /^\d{4}-\d{2}-\d{2}/i;
215-
EntityRecognizer.yesExp = /^(1|y|yes|yep|sure|ok|true)(\W|$)/i;
216-
EntityRecognizer.noExp = /^(2|n|no|nope|not|false)(\W|$)/i;
217-
EntityRecognizer.numberExp = /[+-]?(?:\d+\.?\d*|\d*\.?\d+)/;
218-
EntityRecognizer.ordinalWords = 'first|second|third|fourth|fifth|sixth|seventh|eigth|ninth|tenth';
219214
return EntityRecognizer;
220215
}());
216+
EntityRecognizer.dateExp = /^\d{4}-\d{2}-\d{2}/i;
217+
EntityRecognizer.yesExp = /^(1|y|yes|yep|sure|ok|true)(\W|$)/i;
218+
EntityRecognizer.noExp = /^(2|n|no|nope|not|false)(\W|$)/i;
219+
EntityRecognizer.numberExp = /[+-]?(?:\d+\.?\d*|\d*\.?\d+)/;
220+
EntityRecognizer.ordinalWords = 'first|second|third|fourth|fifth|sixth|seventh|eigth|ninth|tenth';
221221
exports.EntityRecognizer = EntityRecognizer;

Node/core/lib/dialogs/PromptRecognizers.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -263,11 +263,11 @@ var PromptRecognizers = (function () {
263263
if (min === void 0) { min = 0.5; }
264264
return Math.min(min + (entity.length / utterance.length), max);
265265
};
266-
PromptRecognizers.numOrdinals = {};
267-
PromptRecognizers.expCache = {};
268-
PromptRecognizers.choiceCache = {};
269266
return PromptRecognizers;
270267
}());
268+
PromptRecognizers.numOrdinals = {};
269+
PromptRecognizers.expCache = {};
270+
PromptRecognizers.choiceCache = {};
271271
exports.PromptRecognizers = PromptRecognizers;
272272
function matchAll(exp, text) {
273273
exp.lastIndex = 0;

Node/core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "botbuilder",
33
"author": "Microsoft Corp.",
44
"description": "Bot Builder is a dialog system for building rich bots on virtually any platform.",
5-
"version": "3.10.2",
5+
"version": "3.10.5",
66
"license": "MIT",
77
"keywords": [
88
"botbuilder",

0 commit comments

Comments
 (0)