93 references to WithScope
Aspire.Hosting.Azure.EntraId (4)
EntraIdResourceExtensions.cs (4)
2287
/// <see cref="
WithScope
"/> uses this URI unless <see cref="WithApplicationIdUri(IResourceBuilder{EntraIdApplicationResource}, string)"/> sets another one.
2458
return builder.
WithScope
(name, description, scope =>
2507
/// <param name="scopeNames">The names of the scopes, added with <see cref="
WithScope
"/>, that the client may request.</param>
2557
/// <param name="scopeNames">The names of the scopes, added with <see cref="
WithScope
"/> to <paramref name="api"/>.</param>
Aspire.Hosting.Azure.EntraId.Tests (89)
EntraIdApiProvisioningTests.cs (81)
32
.
WithScope
("access_as_user", ScopeDescription);
53
.
WithScope
("orders.read", "Read orders.", scope =>
60
.
WithScope
("orders.write", "Write orders.", scope => scope.IsEnabled = false);
82
var api = builder.AddEntraIdApplication("entra-api").
WithScope
("access_as_user", ScopeDescription);
98
var api = builder.AddEntraIdApplication(resourceName).
WithScope
(scopeName, ScopeDescription);
118
var first = builder.AddEntraIdApplication("entra-api").
WithScope
("access_as_user", "Original description.");
119
var second = builder.AddEntraIdApplication("entra-api2").
WithScope
("access_as_user", "Changed description.");
133
var api = builder.AddEntraIdApplication("entra-api").
WithScope
("access_as_user", ScopeDescription, scope => scope.Id = id);
150
Assert.ThrowsAny<ArgumentException>(() => api.
WithScope
(name, ScopeDescription));
160
api.
WithScope
(new string('a', 120), ScopeDescription);
161
Assert.Throws<ArgumentException>(() => api.
WithScope
(new string('b', 121), ScopeDescription));
169
var api = builder.AddEntraIdApplication("entra-api").
WithScope
("access_as_user", ScopeDescription, scope => scope.Id = id);
171
Assert.Throws<ArgumentException>(() => api.
WithScope
("ACCESS_AS_USER", ScopeDescription));
172
Assert.Throws<ArgumentException>(() => api.
WithScope
("other", ScopeDescription, scope => scope.Id = id));
184
var api = builder.AddEntraIdApplication("entra-api").
WithScope
(name, ScopeDescription);
223
.
WithScope
("access_as_user", ScopeDescription)
227
.
WithScope
("access_as_user", ScopeDescription)
274
.
WithScope
("read", "Read data.", scope => scope.Id = Guid.Parse(ClientId))
395
var api = builder.AddEntraIdApplication("entra-api").
WithScope
("access_as_user", ScopeDescription);
416
.
WithScope
("access_as_user", ScopeDescription)
417
.
WithScope
("other", "Another scope.");
442
.
WithScope
("orders.read", "Read orders.", scope => scope.Id = Guid.Parse("11112222-aaaa-3333-bbbb-4444cccc5555"));
444
.
WithScope
("items.read", "Read items.", scope => scope.Id = Guid.Parse("22223333-aaaa-4444-bbbb-5555cccc6666"));
459
.
WithScope
("orders.read", "Read orders.", scope => scope.Id = Guid.NewGuid());
470
.
WithScope
("orders.read", "Read orders.");
488
.
WithScope
("access_as_user", ScopeDescription)
489
.
WithScope
("retired", "Retired.", scope => scope.IsEnabled = false);
504
var api = builder.AddEntraIdApplication("entra-api").
WithScope
("access_as_user", ScopeDescription);
527
.
WithScope
("access_as_user", ScopeDescription)
546
.
WithScope
("items.read", "Read items.", scope => scope.Id = Guid.NewGuid());
654
var api = builder.AddEntraIdApplication("entra-api").
WithScope
("access_as_user", ScopeDescription);
673
.
WithScope
("access_as_user", ScopeDescription)
674
.
WithScope
("other", "Another scope.")
689
.
WithScope
("access_as_user", ScopeDescription)
690
.
WithScope
("retired", "Retired.", scope => scope.IsEnabled = false);
702
var api = builder.AddEntraIdApplication("entra-api").
WithScope
("access_as_user", ScopeDescription);
709
var other = builder.AddEntraIdApplication("other-api").
WithScope
("access_as_user", ScopeDescription);
720
var a = builder.AddEntraIdApplication("a").
WithScope
("scope", ScopeDescription);
721
var b = builder.AddEntraIdApplication("b").
WithScope
("scope", ScopeDescription);
722
var c = builder.AddEntraIdApplication("c").
WithScope
("scope", ScopeDescription);
736
.
WithScope
("access_as_user", ScopeDescription)
748
var created = builder.AddEntraIdApplication("created-api").
WithScope
("access_as_user", ScopeDescription);
749
var custom = builder.AddEntraIdApplication("custom-api").WithApplicationIdUri("api://contoso-orders").
WithScope
("orders.read", "Read orders.");
751
existing.
WithScope
("items.read", "Read items.", scope => scope.Id = Guid.NewGuid());
753
existingWithoutUri.
WithScope
("items.read", "Read items.", scope => scope.Id = Guid.NewGuid());
768
.
WithScope
("access_as_user", ScopeDescription);
797
var api = builder.AddEntraIdApplication("entra-api").
WithScope
("access_as_user", ScopeDescription);
865
.
WithScope
("orders.read", "Read orders.", scope => scope.Id = Guid.NewGuid());
868
.
WithScope
("items.read", "Read items.", scope => scope.Id = Guid.NewGuid());
891
.
WithScope
("items.read", "Read items.", scope => scope.Id = Guid.NewGuid());
917
var api = builder.AddEntraIdApplication("api-entra").
WithScope
("access_as_user", ScopeDescription);
945
var orders = builder.AddEntraIdApplication("orders-entra").
WithScope
("orders.read", "Read orders.");
946
var items = builder.AddEntraIdApplication("items-entra").
WithScope
("items.read", "Read items.");
975
.WithApplicationIdUri("api://orders").
WithScope
("orders.read", "Read orders.", s => s.Id = Guid.NewGuid());
977
.WithApplicationIdUri("api://items").
WithScope
("items.read", "Read items.", s => s.Id = Guid.NewGuid());
1021
.
WithScope
("access_as_user", ScopeDescription, scope => scope.Id = Guid.NewGuid())
1022
.
WithScope
("retired", "Retired.", scope => { scope.Id = Guid.NewGuid(); scope.IsEnabled = false; })
1023
.
WithScope
("other", "Another scope.", scope => scope.Id = Guid.NewGuid());
1090
.
WithScope
("access_as_user", ScopeDescription, scope => scope.Id = Guid.NewGuid());
1112
.
WithScope
("access_as_user", ScopeDescription, scope => scope.Id = Guid.NewGuid());
1130
.
WithScope
("access_as_user", ScopeDescription, scope => scope.Id = Guid.NewGuid());
1150
.
WithScope
("access_as_user", ScopeDescription, scope => scope.Id = Guid.NewGuid());
1180
.WithApplicationIdUri("api://orders").
WithScope
("orders.read", "Read orders.", s => s.Id = Guid.NewGuid());
1182
.WithApplicationIdUri("api://items").
WithScope
("items.read", "Read items.", s => s.Id = Guid.NewGuid());
1202
.
WithScope
("items.read", "Read items.", s => s.Id = Guid.NewGuid());
1218
.WithApplicationIdUri("api://items").
WithScope
("items.read", "Read items.", s => s.Id = Guid.NewGuid());
1237
var hyphenated = builder.AddEntraIdApplication("orders-api").
WithScope
("read", "Read");
1238
var camel = builder.AddEntraIdApplication("ordersApi").
WithScope
("read", "Read");
1324
var api = builder.AddEntraIdApplication("orders-api").
WithScope
("read", "Read");
1347
.
WithScope
("read", "Read");
1362
.
WithScope
("read", "Read", scope => scope.Id = Guid.NewGuid());
1364
.
WithScope
("read", "Read")
1391
.
WithScope
("read", "Read", scope => scope.Id = Guid.NewGuid())
1392
.
WithScope
("write", "Write", scope => scope.Id = Guid.NewGuid());
1444
.
WithScope
("read", "Read", scope => scope.Id = Guid.NewGuid());
1447
.
WithScope
("read", "Read", scope => scope.Id = Guid.NewGuid());
1564
.
WithScope
("access_as_user", ScopeDescription)
1565
.
WithScope
("other", "Another scope.");
1593
.
WithScope
("orders.read", "Read orders.", scope => scope.Id = firstId);
1609
.
WithScope
("orders.read", "Read orders.", scope => scope.Id = Guid.NewGuid());
1622
var api = builder.AddEntraIdApplication("entra-api").
WithScope
("access_as_user", ScopeDescription);
EntraIdPolyglotTests.cs (4)
42
.
WithScope
("read", "Read data.");
453
.
WithScope
("access_as_user", "Allows the app to call the API.")
454
.
WithScope
("admin", "Administer the API.", scope =>
504
.
WithScope
("orders.read", "Read orders.", scope => scope.Id = scopeId);
EntraIdProvisioningTests.cs (3)
153
.
WithScope
("read", "Read data.", scope => scope.Id = Guid.Parse(ClientId));
155
.
WithScope
("read", "Read data.", scope => scope.Id = Guid.Parse(ClientId))
814
.
WithScope
("read", "Read data.")
EntraIdStarterScenarioPublishTests.cs (1)
36
.
WithScope
("access_as_user", "Access the weather API on behalf of the signed-in user");