Skip to content
This repository was archived by the owner on May 17, 2024. It is now read-only.

Commit 63594ee

Browse files
minor edit to scope name and some more
1 parent e5afed0 commit 63594ee

File tree

5 files changed

+34
-14
lines changed

5 files changed

+34
-14
lines changed

5-AccessControl/2-call-api-groups/API/TodoListAPI/appsettings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"TenantId": "Enter the ID of your Azure AD tenant copied from the Azure portal",
55
"ClientId": "Enter the application ID (clientId) of the 'TodoListAPI' application copied from the Azure portal",
66
"ClientSecret": "Enter the Client Secret of the 'TodoListAPI' application copied from the Azure portal",
7-
"Scopes": [ "access_via_group_assignment" ],
7+
"Scopes": [ "access_via_group_assignments" ],
88
"Groups": {
99
"GroupAdmin": "Enter the objectID for GroupAdmin group copied from Azure Portal",
1010
"GroupMember": "Enter the objectID for GroupMember group copied from Azure Portal"

5-AccessControl/2-call-api-groups/AppCreationScripts/Cleanup.ps1

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,16 @@ Function Cleanup
7272
Write-Warning $Error[0]
7373
Write-Host "Unable to remove ServicePrincipal 'msal-angular-app'. Error is $message. Try deleting manually from Enterprise applications." -ForegroundColor White -BackgroundColor Red
7474
}
75+
Write-Host "You may want to remove the security group 'GroupAdmin' if it was created to test this sample only."
76+
#if($null -ne (Get-MgGroup -Filter "DisplayName eq 'GroupAdmin'"))
77+
#{
78+
# Remove-MgGroup -GroupId (Get-MgGroup -Filter "DisplayName eq 'GroupAdmin'").Id
79+
#}
80+
Write-Host "You may want to remove the security group 'GroupMember' if it was created to test this sample only."
81+
#if($null -ne (Get-MgGroup -Filter "DisplayName eq 'GroupMember'"))
82+
#{
83+
# Remove-MgGroup -GroupId (Get-MgGroup -Filter "DisplayName eq 'GroupMember'").Id
84+
#}
7585
}
7686

7787
if ($null -eq (Get-Module -ListAvailable -Name "Microsoft.Graph.Applications")) {

5-AccessControl/2-call-api-groups/AppCreationScripts/sample.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@
3737
"SampleSubPath": "5-AccessControl\\2-call-api-groups\\SPA",
3838
"ProjectDirectory": "\\2-call-api-groups\\SPA"
3939
},
40+
"SecurityGroups":[
41+
{"Name":"GroupAdmin", "Description":"Admin Security Group"},
42+
{"Name":"GroupMember", "Description":"User Security Group"}
43+
],
4044
"RequiredResourcesAccess": [
4145
{
4246
"Resource": "client",

5-AccessControl/2-call-api-groups/README.md

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
---
22
page_type: sample
3+
services: ms-identity
4+
client: Angular SPA
5+
service: .NET Core web API
6+
level: 300
37
languages:
48
- typescript
59
- csharp
@@ -10,12 +14,14 @@ products:
1014
- msal-js
1115
- msal-angular
1216
- microsoft-identity-web
13-
name: Angular single-page application calling a protected Core web API using Security Groups to implement Role-Based Access Control
14-
description: Angular single-page application calling a protected web API using App Roles to implement Role-Based Access Control
17+
platform: javascript
18+
endpoint: AAD v2.0
1519
urlFragment: ms-identity-javascript-angular-tutorial
20+
name: Angular single-page application calling a protected AspNet Core web API and using Security Groups to implement Role-Based Access Control
21+
description: Angular single-page application calling a protected AspNet web API and using Security Groups to implement Role-Based Access Control (RBAC)
1622
---
1723

18-
# Angular single-page application calling a protected Core web API using Security Groups to implement Role-Based Access Control
24+
# Angular single-page application calling a protected AspNet Core web API and using Security Groups to implement Role-Based Access Control
1925

2026
* [Overview](#overview)
2127
* [Scenario](#scenario)
@@ -109,7 +115,7 @@ For more information and potential issues, see: [HTTPS in .NET Core](https://doc
109115

110116
> :information_source: While there are multiple project in this sample, we'd register just one app with Azure AD and use the registered app's *client id* in both apps. This reuse of app ids (client ids) is used when the apps themselves are just components of one larger app topology.
111117
112-
There are two projects in this sample. To register it, you can:
118+
There is one project in this sample. To register it, you can:
113119

114120
- follow the steps below for manually register your apps
115121
- or use PowerShell scripts that:
@@ -172,12 +178,12 @@ To manually register the apps, as a first step you'll need to:
172178
173179
1. All APIs must publish a minimum of one [scope](https://docs.microsoft.com/azure/active-directory/develop/v2-oauth2-auth-code-flow#request-an-authorization-code), also called [Delegated Permission](https://docs.microsoft.com/azure/active-directory/develop/v2-permissions-and-consent#permission-types), for the client apps to obtain an access token for a *user* successfully. To publish a scope, follow these steps:
174180
1. Select **Add a scope** button open the **Add a scope** screen and Enter the values as indicated below:
175-
1. For **Scope name**, use `access_via_group_assignment`.
181+
1. For **Scope name**, use `access_via_group_assignments`.
176182
1. Select **Admins and users** options for **Who can consent?**.
177-
1. For **Admin consent display name** type in *Access 'msal-angular-app' as the signed-in user.*.
178-
1. For **Admin consent description** type in *Allow the app to access the 'msal-angular-app' as a signed-in user.*.
179-
1. For **User consent display name** type in *Access 'msal-angular-app' on your behalf.*.
180-
1. For **User consent description** type in *Allow the app to access the 'msal-angular-app' on your behalf.*.
183+
1. For **Admin consent display name** type in *Access 'msal-angular-app' as the signed-in user assigned to group memberships.*.
184+
1. For **Admin consent description** type in *Allow the app to access the 'msal-angular-app' as a signed-in user assigned to one or more security groups.*.
185+
1. For **User consent display name** type in *Access 'msal-angular-app' on your behalf after security group assignment.*.
186+
1. For **User consent description** type in *Allow the app to access the 'msal-angular-app' on your behalf after assignment to one or more security groups.*.
181187
1. Keep **State** as **Enabled**.
182188
1. Select the **Add scope** button on the bottom to save this scope.
183189
1. Select the **Manifest** blade on the left.
@@ -193,14 +199,14 @@ To manually register the apps, as a first step you'll need to:
193199
1. Select the **Add a permission** button and then:
194200
1. Ensure that the **My APIs** tab is selected.
195201
1. In the list of APIs, select the API `msal-angular-app`.
196-
1. Since this app signs-in users, we will now proceed to select **delegated permissions**, which is is requested by apps when signing-in users.
197-
1. In the **Delegated permissions** section, select the **Access 'msal-angular-app'** in the list. Use the search box if necessary.
202+
* Since this app signs-in users, we will now proceed to select **delegated permissions**, which is is requested by apps when signing-in users.
203+
1. In the **Delegated permissions** section, select **access_via_group_assignments** in the list. Use the search box if necessary.
198204
1. Select the **Add permissions** button at the bottom.
199205
1. Select the **Add a permission** button and then:
200206
1. Ensure that the **Microsoft APIs** tab is selected.
201207
1. In the *Commonly used Microsoft APIs* section, select **Microsoft Graph**
202208
* Since this app signs-in users, we will now proceed to select **delegated permissions**, which is is requested by apps when signing-in users.
203-
1. In the **Delegated permissions** section, select the **User.Read**, **GroupMember.Read.All** in the list. Use the search box if necessary.
209+
1. In the **Delegated permissions** section, select **User.Read**, **GroupMember.Read.All** in the list. Use the search box if necessary.
204210
1. Select the **Add permissions** button at the bottom.
205211
206212
##### Configure Optional Claims

5-AccessControl/2-call-api-groups/SPA/src/app/auth-config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export const msalConfig: Configuration = {
4848
export const protectedResources = {
4949
apiTodoList: {
5050
endpoint: "https://localhost:44351/api/todolist",
51-
scopes: ["api://Enter_the_Web_Api_Application_Id_Here/access_via_group_assignment"]
51+
scopes: ["api://Enter_the_Web_Api_Application_Id_Here/access_via_group_assignments"]
5252
},
5353
apiGraph: {
5454
endpoint: "https://graph.microsoft.com/v1.0/me/memberOf",

0 commit comments

Comments
 (0)