88 references to WithScope
Aspire.Hosting.Azure.EntraId (4)
EntraIdResourceExtensions.cs (4)
1969
/// <see cref="
WithScope
"/> uses this URI unless <see cref="WithApplicationIdUri(IResourceBuilder{EntraIdApplicationResource}, string)"/> sets another one.
2143
return builder.
WithScope
(name, description, scope =>
2192
/// <param name="scopeNames">The names of the scopes, added with <see cref="
WithScope
"/>, that the client may request.</param>
2240
/// <param name="scopeNames">The names of the scopes, added with <see cref="
WithScope
"/> to <paramref name="api"/>.</param>
Aspire.Hosting.Azure.EntraId.Tests (84)
EntraIdApiProvisioningTests.cs (80)
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)
345
var api = builder.AddEntraIdApplication("entra-api").
WithScope
("access_as_user", ScopeDescription);
366
.
WithScope
("access_as_user", ScopeDescription)
367
.
WithScope
("other", "Another scope.");
392
.
WithScope
("orders.read", "Read orders.", scope => scope.Id = Guid.Parse("11112222-aaaa-3333-bbbb-4444cccc5555"));
394
.
WithScope
("items.read", "Read items.", scope => scope.Id = Guid.Parse("22223333-aaaa-4444-bbbb-5555cccc6666"));
409
.
WithScope
("orders.read", "Read orders.", scope => scope.Id = Guid.NewGuid());
420
.
WithScope
("orders.read", "Read orders.");
438
.
WithScope
("access_as_user", ScopeDescription)
439
.
WithScope
("retired", "Retired.", scope => scope.IsEnabled = false);
454
var api = builder.AddEntraIdApplication("entra-api").
WithScope
("access_as_user", ScopeDescription);
477
.
WithScope
("access_as_user", ScopeDescription)
496
.
WithScope
("items.read", "Read items.", scope => scope.Id = Guid.NewGuid());
604
var api = builder.AddEntraIdApplication("entra-api").
WithScope
("access_as_user", ScopeDescription);
623
.
WithScope
("access_as_user", ScopeDescription)
624
.
WithScope
("other", "Another scope.")
639
.
WithScope
("access_as_user", ScopeDescription)
640
.
WithScope
("retired", "Retired.", scope => scope.IsEnabled = false);
652
var api = builder.AddEntraIdApplication("entra-api").
WithScope
("access_as_user", ScopeDescription);
659
var other = builder.AddEntraIdApplication("other-api").
WithScope
("access_as_user", ScopeDescription);
670
var a = builder.AddEntraIdApplication("a").
WithScope
("scope", ScopeDescription);
671
var b = builder.AddEntraIdApplication("b").
WithScope
("scope", ScopeDescription);
672
var c = builder.AddEntraIdApplication("c").
WithScope
("scope", ScopeDescription);
686
.
WithScope
("access_as_user", ScopeDescription)
698
var created = builder.AddEntraIdApplication("created-api").
WithScope
("access_as_user", ScopeDescription);
699
var custom = builder.AddEntraIdApplication("custom-api").WithApplicationIdUri("api://contoso-orders").
WithScope
("orders.read", "Read orders.");
701
existing.
WithScope
("items.read", "Read items.", scope => scope.Id = Guid.NewGuid());
703
existingWithoutUri.
WithScope
("items.read", "Read items.", scope => scope.Id = Guid.NewGuid());
718
.
WithScope
("access_as_user", ScopeDescription);
747
var api = builder.AddEntraIdApplication("entra-api").
WithScope
("access_as_user", ScopeDescription);
815
.
WithScope
("orders.read", "Read orders.", scope => scope.Id = Guid.NewGuid());
818
.
WithScope
("items.read", "Read items.", scope => scope.Id = Guid.NewGuid());
841
.
WithScope
("items.read", "Read items.", scope => scope.Id = Guid.NewGuid());
867
var api = builder.AddEntraIdApplication("api-entra").
WithScope
("access_as_user", ScopeDescription);
895
var orders = builder.AddEntraIdApplication("orders-entra").
WithScope
("orders.read", "Read orders.");
896
var items = builder.AddEntraIdApplication("items-entra").
WithScope
("items.read", "Read items.");
925
.WithApplicationIdUri("api://orders").
WithScope
("orders.read", "Read orders.", s => s.Id = Guid.NewGuid());
927
.WithApplicationIdUri("api://items").
WithScope
("items.read", "Read items.", s => s.Id = Guid.NewGuid());
971
.
WithScope
("access_as_user", ScopeDescription, scope => scope.Id = Guid.NewGuid())
972
.
WithScope
("retired", "Retired.", scope => { scope.Id = Guid.NewGuid(); scope.IsEnabled = false; })
973
.
WithScope
("other", "Another scope.", scope => scope.Id = Guid.NewGuid());
1040
.
WithScope
("access_as_user", ScopeDescription, scope => scope.Id = Guid.NewGuid());
1062
.
WithScope
("access_as_user", ScopeDescription, scope => scope.Id = Guid.NewGuid());
1080
.
WithScope
("access_as_user", ScopeDescription, scope => scope.Id = Guid.NewGuid());
1100
.
WithScope
("access_as_user", ScopeDescription, scope => scope.Id = Guid.NewGuid());
1130
.WithApplicationIdUri("api://orders").
WithScope
("orders.read", "Read orders.", s => s.Id = Guid.NewGuid());
1132
.WithApplicationIdUri("api://items").
WithScope
("items.read", "Read items.", s => s.Id = Guid.NewGuid());
1152
.
WithScope
("items.read", "Read items.", s => s.Id = Guid.NewGuid());
1168
.WithApplicationIdUri("api://items").
WithScope
("items.read", "Read items.", s => s.Id = Guid.NewGuid());
1187
var hyphenated = builder.AddEntraIdApplication("orders-api").
WithScope
("read", "Read");
1188
var camel = builder.AddEntraIdApplication("ordersApi").
WithScope
("read", "Read");
1274
var api = builder.AddEntraIdApplication("orders-api").
WithScope
("read", "Read");
1297
.
WithScope
("read", "Read");
1312
.
WithScope
("read", "Read", scope => scope.Id = Guid.NewGuid());
1314
.
WithScope
("read", "Read")
1341
.
WithScope
("read", "Read", scope => scope.Id = Guid.NewGuid())
1342
.
WithScope
("write", "Write", scope => scope.Id = Guid.NewGuid());
1394
.
WithScope
("read", "Read", scope => scope.Id = Guid.NewGuid());
1397
.
WithScope
("read", "Read", scope => scope.Id = Guid.NewGuid());
1514
.
WithScope
("access_as_user", ScopeDescription)
1515
.
WithScope
("other", "Another scope.");
1543
.
WithScope
("orders.read", "Read orders.", scope => scope.Id = firstId);
1559
.
WithScope
("orders.read", "Read orders.", scope => scope.Id = Guid.NewGuid());
1572
var api = builder.AddEntraIdApplication("entra-api").
WithScope
("access_as_user", ScopeDescription);
EntraIdPolyglotTests.cs (3)
364
.
WithScope
("access_as_user", "Allows the app to call the API.")
365
.
WithScope
("admin", "Administer the API.", scope =>
413
.
WithScope
("orders.read", "Read orders.", scope => scope.Id = scopeId);
EntraIdStarterScenarioPublishTests.cs (1)
36
.
WithScope
("access_as_user", "Access the weather API on behalf of the signed-in user");