Skip to content

Commit 7476b1e

Browse files
authored
Merge pull request #291 from microsoft/users/tracyboehrer/minor-oauthsettings-enhancement
Handle "OBOScopes" as a string instead of an array
2 parents 368177b + 7fb1d73 commit 7476b1e

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

src/libraries/Builder/Microsoft.Agents.Builder/UserAuth/TokenService/AzureBotUserAuthorization.cs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public class AzureBotUserAuthorization : IUserAuthorization
2525
private readonly IConnections _connections;
2626

2727
public AzureBotUserAuthorization(string name, IStorage storage, IConnections connections, IConfigurationSection configurationSection)
28-
: this(name, storage, connections, configurationSection.Get<OAuthSettings>())
28+
: this(name, storage, connections, GetOAuthSettings(configurationSection))
2929
{
3030

3131
}
@@ -169,5 +169,22 @@ private bool TryGetOBOProvider(string connectionName, out IOBOExchange oboExchan
169169
oboExchangeProvider = null;
170170
return false;
171171
}
172+
173+
private static OAuthSettings GetOAuthSettings(IConfigurationSection config)
174+
{
175+
var settings = config.Get<OAuthSettings>();
176+
177+
if (settings.OBOScopes == null)
178+
{
179+
// try reading as a string to compensate for users just setting a non-array string
180+
var configScope = config.GetSection(nameof(OAuthSettings.OBOScopes)).Get<string>();
181+
if (!string.IsNullOrEmpty(configScope))
182+
{
183+
settings.OBOScopes = [configScope];
184+
}
185+
}
186+
187+
return settings;
188+
}
172189
}
173190
}

0 commit comments

Comments
 (0)