Skip to content

Commit fb5ed70

Browse files
committed
Updated with diagram
1 parent 95a3711 commit fb5ed70

File tree

1 file changed

+124
-65
lines changed

1 file changed

+124
-65
lines changed

specs/permissions.md

Lines changed: 124 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ The canonical model for a permissions document is a JSON [JSON] object. When ser
3232
}
3333
}
3434
```
35+
3536
In this example, the claim "PrintSettings.Read.All" is required when using the "DelegatedWork" security scheme to access the resource "/print/settings" using the "GET" method.
3637

3738
### permissions
@@ -43,13 +44,6 @@ The "permissions" member is a JSON object whose members permission objects. The
4344
### note
4445
The "note" member is a freeform string that provides additional details at about the permission that cannot be determined from the other members of the permission object.
4546

46-
### alsoRequires
47-
The "alsoRequires" member is logical expression of permissions that must be presented as claims alongside the current permission.
48-
49-
```
50-
(User.Read | User.Read.All) & Group.Read
51-
```
52-
5347
### implicit
5448
The "implicit" member is a boolean value that indicates that the current permission object is implied. The default value is "false". This member us usually set to "true" in combination with a "alsoRequires" expression.
5549

@@ -77,20 +71,20 @@ TBD
7771
The "ownerEmail" member is a REQUIRED string that provides a contact mechanism for communicating with the owner of the permission. It is important that owners of permissions are aware when new paths are added to an existing permission.
7872

7973
## <a name="pathSetObject"></a>PathSet Object
80-
A pathSet object identifies a set of paths that are accessible via the identified HTTP methods and schemes. Ideally, a permission object contains a single pathSet object. This indicates that all paths protected by the permission support the same HTTP methods and and schemes. In practice there are cases where support is not uniform. Distinct pathSet objects can be created to separate the paths with varying support.
74+
A pathSet object identifies a set of paths that are accessible have a common set of security characteristics, such as HTTP methods and schemes. Ideally, a permission object contains a single pathSet object. This indicates that all paths protected by the permission support the same characteristics. In practice there are cases where support is not uniform. Distinct pathSet objects can be created to separate the paths with varying characteristics.
8175

8276
> Note: The design chosen was intentional to encourage permission creators to ensure support for methods and schemes is as consistent as possible. This produces a better developer experience for API consumers.
8377
8478
```json
8579
"pathSets": [{
86-
"schemes": ["DelegatedWork"],
80+
"schemeKeys": ["DelegatedWork"],
8781
"methods": ["GET"],
8882
"paths": {
8983
"/print/settings": {}
9084
}
9185
},
9286
{
93-
"schemes": ["Application"],
87+
"schemeKeys": ["Application"],
9488
"methods": ["GET,POST"],
9589
"paths": {
9690
"/print/settings": {}
@@ -99,15 +93,29 @@ A pathSet object identifies a set of paths that are accessible via the identifie
9993
]
10094
```
10195

102-
### schemes
103-
The "schemes" member is a REQUIRED array of strings that reference the schemes defined in the [permission object](#permissionObject) that are supported by the paths in this pathSet object.
96+
### schemeKeys
97+
The "schemeKeys" member is a REQUIRED array of strings that reference the schemes defined in the [permission object](#permissionObject) that are supported by the paths in this pathSet object. Each value in this array MUST match one of the keys of the "schemes" member in the [permission object](#permissionObject).
10498

10599
### methods
106100
The "methods" member is a REQUIRED array of strings that represent the HTTP methods supported by the paths in this pathSet object.
107101

108102
### paths
109103
The "paths" member is a REQUIRED object whose keys contain a simplified URI template to identify the resources protected by this permission object.
110104

105+
### alsoRequires
106+
The "alsoRequires" member is logical expression of permissions that must be presented as claims alongside the current permission.
107+
108+
```
109+
(User.Read | User.Read.All) & Group.Read
110+
```
111+
112+
### includedProperties
113+
The "includedProperties" member is an array of strings that identify properties of the resource representation returned by the path, that are accessible with the permission.
114+
115+
### excludedProperties
116+
The "includedProperties" member is an array of strings that identify properties of the resource representation returned by the path, that are not accessible with the permission.
117+
118+
111119
## <a name="schemeObject"></a>Scheme Object
112120
The scheme object has members that describe the permission within the context of the scheme. Additional members provide behavioral constraints of the permission when used with the scheme.
113121

@@ -121,16 +129,15 @@ The scheme object has members that describe the permission within the context of
121129
"requiresAdminConsent": true
122130
},
123131
"DelegatedPersonal": {
124-
"type": "DelegatedPersonal",
125132
"consentDisplayName": "Read and write app activity to users'activity feed",
126133
"consentDescription": "Allows the app to read and report the signed-in user's activity in the app."
127134
},
128135
"Application": {
129-
"type": "Application",
130136
"adminDisplayName": "Read and write app activity to users' activity feed",
131137
"adminDescription": "Allows the app to read and report the signed-in user's activity in the app.",
132138
}
133139
```
140+
134141
### adminDisplayName
135142
The "adminDisplayName" member is a string that provides a short permission name that considers the current scheme and the perspective of a resource administrator.
136143

@@ -157,16 +164,50 @@ The path object contains properties that affect how the permission object contro
157164
"excludedProperties": ["cost"]
158165
}
159166
```
167+
160168
### leastPrivilegePath
161169
The "leastPrivilegePath" member is an array of strings that identify the schemes for which this permission is the least privilege permission for accessing the path.
162170

163-
### includedProperties
164-
The "includedProperties" member is an array of strings that identify properties of the resource representation returned by the path, that are accessible with the permission.
171+
## Appendix A. Model Diagram
165172

166-
### excludedProperties
167-
The "includedProperties" member is an array of strings that identify properties of the resource representation returned by the path, that are not accessible with the permission.
173+
```mermaid
174+
classDiagram
175+
176+
class Permission{
177+
note: string
178+
implicit: bool
179+
requiredEnvironments: string[]
180+
ownerEmail:string
181+
isHidden: bool
182+
privilegeLevel: string
183+
}
184+
Permission "1" --> "*" PathSet:pathSets
185+
Permission "1" --> "*" Scheme:schemes
186+
187+
class PathSet{
188+
schemeKeys: string[]
189+
methods: string[]
190+
alsoRequires: stringExpression
191+
includedProperties: string[]
192+
excludedProperties: string[]
193+
}
194+
PathSet "1" --> "*" Path:paths
195+
196+
class Path{
197+
leastPrivilegePath: string
198+
}
199+
200+
class Scheme{
201+
adminDisplayName: string
202+
adminDescription: string
203+
userDisplayName: string
204+
userDescription: string
205+
requiresAdminConsent: string
206+
}
168207

169-
## Appendix A. JSON Schema for HTTP Problem
208+
```
209+
210+
## Appendix B. JSON Schema for HTTP Problem
170211
```json
171212
{
172213
"$schema": "http://json-schema.org/draft-07/schema",
@@ -180,56 +221,61 @@ The "includedProperties" member is an array of strings that identify properties
180221
"type": "object",
181222
"patternProperties": {
182223
"[\\w]+\\.[\\w]+[\\.[\\w]+]?": {
183-
"type": "object",
184-
"title": "Permission definition",
185-
"additionalProperties": false,
186-
"properties": {
187-
"note": {
188-
"type": "string"
189-
},
190-
"alsoRequires": {
191-
"type": "string",
192-
"pattern": "[\\w]+\\.[\\w]+[\\.[\\w]+]?"
193-
},
194-
"schemes": {
195-
"type": "object",
196-
"patternProperties": {
197-
".*": {
198-
"$ref": "#/definitions/scheme"
199-
}
200-
}
201-
}
202-
},
203-
"pathSets": {
204-
"type": "array",
205-
"items": {
206-
"$ref": "#/definitions/pathSet"
207-
}
208-
}
209-
}
210-
}
224+
"$ref": "#/definitions/permission"
225+
}
211226
}
212227
}
213228
}
214229
},
215230
"definitions": {
216-
"schemeTypes": {
217-
"type": "string",
218-
"enum": [
219-
"delegated-work",
220-
"delegated-personal",
221-
"application",
222-
"resource-specific-consent"
223-
]
224-
},
225-
"pathSet": {
231+
"permission": {
226232
"type": "object",
233+
"title": "Permission definition",
227234
"additionalProperties": false,
228235
"properties": {
236+
"note": {"type": "string"},
237+
"implicit": {"type": "boolean"},
238+
"isHidden": {"type": "boolean"},
239+
"ownerEmail": {"type": "string"},
240+
"privilegeLevel": {
241+
"type":"string",
242+
"enum":["low","medium","high"]
243+
}
244+
"requiredEnvironments": {
245+
"type": "array",
246+
"items": {
247+
"type": "string"
248+
}
249+
},
250+
"alsoRequires": {
251+
"type": "string",
252+
"pattern": "[\\w]+\\.[\\w]+[\\.[\\w]+]?"
253+
},
229254
"schemes": {
255+
"type": "object",
256+
"patternProperties": {
257+
".*": {
258+
"$ref": "#/definitions/scheme"
259+
}
260+
}
261+
}
262+
},
263+
"pathSets": {
264+
"type": "array",
265+
"items": {
266+
"$ref": "#/definitions/pathSet"
267+
}
268+
}
269+
}
270+
},
271+
"pathSet": {
272+
"type": "object",
273+
"additionalProperties": false,
274+
"properties": {
275+
"schemeKeys": {
230276
"type": "array",
231277
"items": {
232-
"$ref": "#/definitions/schemeTypes"
278+
"type": "string"
233279
}
234280
},
235281
"methods": {
@@ -248,16 +294,26 @@ The "includedProperties" member is an array of strings that identify properties
248294
}
249295
}
250296
}
297+
},
298+
"includeProperties": {
299+
"type": "array",
300+
"items": {
301+
"type": "string"
302+
}
303+
},
304+
"excludeProperties": {
305+
"type": "array",
306+
"items": {
307+
"type": "string"
308+
}
251309
}
252310
},
253311
"path": {
254312
"type": "object",
255313
"properties": {
256-
"excludeProperties": {
314+
"leastPrivilegePath": {
257315
"type": "array",
258-
"items": {
259-
"type": "string"
260-
}
316+
"items": { "type":"string"}
261317
}
262318
},
263319
"scheme": {
@@ -266,10 +322,13 @@ The "includedProperties" member is an array of strings that identify properties
266322
"requiresAdminConsent": {
267323
"type": "boolean"
268324
},
269-
"type": {
270-
"$ref": "#/definitions/schemeTypes"
325+
"adminDisplayName": {
326+
"type": "string"
327+
},
328+
"adminDescription": {
329+
"type": "string"
271330
},
272-
"description": {
331+
"consentDisplayName": {
273332
"type": "string"
274333
},
275334
"consentDescription": {

0 commit comments

Comments
 (0)