@azure/functions-authentication-events 1.0.0-alpha.20221101.1 → 1.0.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Authentication Events Trigger for Azure Functions client library for .NET
1
+ # Authentication Events Trigger for Azure Functions client library for Node
2
2
 
3
3
  Authentication Event Trigger for Azure Functions handles all the backend processing, (e.g. token/json schema validation) for incoming Http requests for Authentication events. And provides the developer with a strongly typed, versioned object model to work with, meaning the developer need not have any prior knowledge of the request and response json payloads.
4
4
 
@@ -12,40 +12,19 @@ This project framework provides the following features:
12
12
 
13
13
  ## Getting started
14
14
 
15
- ### Install the package
15
+ ### Install the npm package
16
16
 
17
- ```dotnetcli
18
- dotnet add package Microsoft.Azure.WebJobs.Extensions.AuthenticationEvents --prerelease
17
+ ```console
18
+ npm install @azure/functions-authentication-events
19
19
  ```
20
20
 
21
21
  ### Prerequisites
22
22
 
23
- * [Visual Studio 2019](https://visualstudio.microsoft.com/vs/) for Windows **OR** [Visual Studio Code >= 1.61](https://code.visualstudio.com/download)
24
- * [Dotnet core 3.1](https://dotnet.microsoft.com/download/dotnet/3.1)
25
- * [Azure function tools 3.30](https://github.com/Azure/azure-functions-core-tools)
26
- * [Nuget](https://docs.microsoft.com/nuget/install-nuget-client-tools)
23
+ * [Azure function tools](https://github.com/Azure/azure-functions-core-tools)
27
24
  * [Azure Function Core Tools](https://github.com/Azure/azure-functions-core-tools#installing)
28
25
  * If using Visual Studio Code the following extensions:
29
26
  * [ms-azuretools.vscode-azurefunctions](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-azurefunctions)
30
27
  * [ms-dotnettools.csharp](https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.csharp)
31
- * For private preview register a Nuget source either using Nuget''s cli **OR** Visual Studio's Nuget Package Manager.
32
- * Generate a GIT Personal Access Token. Go to [https://github.com/settings/tokens](https://github.com/settings/tokens)
33
- * When generating the token, it needs to have the following permissions/scope: **read:package**
34
- * Authorize **Azure** to use the Personal Access Token. (::Only if you are a member of the Azure Organization on GitHub::)
35
-
36
- * Nuget CLI (**Recommended**):
37
- * **GIT-USERNAME**: Your GIT username that you log into GIT with.
38
- * **GIT-PERSONAL-ACCESS-TOKEN**: Your GIT Personal access token (see below reference on how to generate one)
39
-
40
- ```shell
41
- nuget sources add -Name "Azure" -Source "https://nuget.pkg.github.com/Azure/index.json" -username "**[GIT-USERNAME]**" -password "**[GIT-PERSONAL-ACCESS-TOKEN]**"
42
- ```
43
-
44
- * More details can be found here
45
- * [Nuget Source](https://docs.microsoft.com/nuget/reference/cli-reference/cli-ref-sources)
46
- * [How to Generate a GIT Personal Access Token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token)
47
- * Visual Studio's Nuget Package Manager
48
- * You'll be prompted for credentials when accessing the source, so keep you Personal Access Token handy as this would be your password.
49
28
 
50
29
  ### Authenticate the Client
51
30
 
@@ -115,17 +94,14 @@ If you would like to _not_ authenticate the token while in local development, se
115
94
 
116
95
  ### Quickstart
117
96
 
118
- * Visual Studio 2019
119
- * Start Visual Studio
120
- * Select "Create a new project"
121
- * In the template search area search and select "AzureAuthEventsTrigger"
122
- * Give your project a meaningful Project Name, Location, Solution and Solution Name.
123
-
124
97
  * Visual Studio Code
125
98
  * Start Visual Studio Code
126
- * Run the command "Create Azure Authentication Events Trigger Project" via the command palette
99
+ * Run the terminal command `func init . --worker-runtime node` via the command palette
100
+ * Run the terminal command `func new` via the command palette
127
101
  * Follow the project creation prompts
128
- * Please note: that on a first time run it might take awhile to download the the required packages.
102
+ * Run the terminal command `npm install @azure/functions-authentication-events` via the command palette
103
+ * Run the terminal command `npm install` via the command palette
104
+ * Run the terminal command `npm run-script build` via the command palette
129
105
  * For development purpose turn of token validation for testing:
130
106
  * Add the **AuthenticationEvents__BypassTokenValidation** application key to the "Values" section in the local.settings.json file and set it's value to **true**. If you do not have a local.settings.json file in your local environment, create one in the root of your Function App.
131
107
 
@@ -134,7 +110,7 @@ If you would like to _not_ authenticate the token while in local development, se
134
110
  "IsEncrypted": false,
135
111
  "Values": {
136
112
  "AzureWebJobsStorage": "UseDevelopmentStorage=true",
137
- "FUNCTIONS_WORKER_RUNTIME": "dotnet",
113
+ "FUNCTIONS_WORKER_RUNTIME": "node",
138
114
  "AuthenticationEvents__BypassTokenValidation": true
139
115
  }
140
116
  }
@@ -157,9 +133,8 @@ Key concepts of the Azure .NET SDK can be found [here](https://azure.github.io/a
157
133
 
158
134
  To Test Token Augmentation, please do the following.
159
135
 
160
- * Start Visual Studio.
161
136
  * Open the project that was created in the prior step. (QuickStart)
162
- * Run the Application. (F5)
137
+ * Run the Application. `func host start`
163
138
  * Once the Azure functions developer's application has started, copy the listening url that is displayed with the application starts up.
164
139
  * Note: All Authentication functions are listed, in the case we have one function listener registered called "**OnTokenIssuanceStart**"
165
140
  * Your function endpoint will then be a combination of the listening url and function, for example: "http://localhost:7071/runtime/webhooks/AuthenticationEvents?code=(YOUR_CODE)&function=OnTokenIssuanceStart"
@@ -168,52 +143,45 @@ To Test Token Augmentation, please do the following.
168
143
 
169
144
  ```json
170
145
  {
171
- "type":"microsoft.graph.authenticationEvent.TokenIssuanceStart",
172
- "source":"/tenants/{tenantId}/applications/{resourceAppId}",
173
- "data":{
174
- "@odata.type": "microsoft.graph.onTokenIssuanceStartCalloutData",
175
- "tenantId": "30000000-0000-0000-0000-000000000003",
176
- "authenticationEventListenerId1": "10000000-0000-0000-0000-000000000001",
177
- "customAuthenticationExtensionId": "10000000-0000-0000-0000-000000000002",
178
- "authenticationContext1":{
179
- "correlationId": "20000000-0000-0000-0000-000000000002",
180
- "client": {
181
- "ip": "127.0.0.1",
182
- "locale": "en-us",
183
- "market": "en-au"
184
- },
185
- "authenticationProtocol": "OAUTH2.0",
186
- "clientServicePrincipal": {
187
- "id": "40000000-0000-0000-0000-000000000001",
188
- "appId": "40000000-0000-0000-0000-000000000002",
189
- "appDisplayName": "Test client app",
190
- "displayName": "Test client application"
191
- },
192
- "resourceServicePrincipal": {
193
- "id": "40000000-0000-0000-0000-000000000003",
194
- "appId": "40000000-0000-0000-0000-000000000004",
195
- "appDisplayName": "Test resource app",
196
- "displayName": "Test resource application"
197
- },
198
- "user": {
199
- "companyName": "Nick Gomez",
200
- "country": "USA",
201
- "createdDateTime": "0001-01-01T00:00:00Z",
202
- "displayName": "Dummy display name",
203
- "givenName": "Example",
204
- "id": "60000000-0000-0000-0000-000000000006",
205
- "mail": "test@example.com",
206
- "onPremisesSamAccountName": "testadmin",
207
- "onPremisesSecurityIdentifier": "DummySID",
208
- "onPremisesUserPrincipalName": "Dummy Name",
209
- "preferredDataLocation": "DummyDataLocation",
210
- "preferredLanguage": "DummyLanguage",
211
- "surname": "Test",
212
- "userPrincipalName": "testadmin@example.com",
213
- "userType": "UserTypeCloudManaged"
214
- }
146
+ "type": "microsoft.graph.authenticationEvent.tokenIssuanceStart",
147
+ "source": "/tenants/00000001-0000-0ff1-ce00-000000000000/applications/ef9e995c-efdb-4e76-97a9-8cdfc6e06afc",
148
+ "data": {
149
+ "@odata.type": "microsoft.graph.onTokenIssuanceStartCalloutData",
150
+ "tenantId": "00000001-0000-0ff1-ce00-000000000000",
151
+ "authenticationEventListenerId": "f2390d57-9664-4dde-b625-f0115925e1e2",
152
+ "customAuthenticationExtensionId": "9cc1c1ed-5f04-4fdf-85c0-94a7c6ea819c",
153
+ "authenticationContext": {
154
+ "correlationId": "f4bd1870-b774-4fa5-ba78-e08ac6be14c0",
155
+ "client": {
156
+ "ip": "127.0.0.1",
157
+ "locale": "en-us",
158
+ "market": "en-us"
159
+ },
160
+ "protocol": "OAUTH2.0",
161
+ "clientServicePrincipal": {
162
+ "id": "eedfddb9-304e-4d62-aa83-24700a0bcf0e",
163
+ "appId": "ef9e995c-efdb-4e76-97a9-8cdfc6e06afc",
164
+ "appDisplayName": "",
165
+ "displayName": "Test application"
166
+ },
167
+ "resourceServicePrincipal": {
168
+ "id": "eedfddb9-304e-4d62-aa83-24700a0bcf0e",
169
+ "appId": "ef9e995c-efdb-4e76-97a9-8cdfc6e06afc",
170
+ "appDisplayName": "",
171
+ "displayName": "Test application"
172
+ },
173
+ "user": {
174
+ "companyName": "Evo Sts Test",
175
+ "country": "",
176
+ "id": "69d24544-c420-4721-a4bf-106f2378d9f6",
177
+ "mail": "testadmin@evostsoneboxtest.com",
178
+ "onPremisesSamAccountName": "testadmin",
179
+ "onPremisesSecurityIdentifier": "testadmin",
180
+ "preferredDataLocation": "",
181
+ "userPrincipalName": "testadmin@evostsoneboxtest.com"
182
+ }
183
+ }
215
184
  }
216
- }
217
185
  }
218
186
  ```
219
187
 
package/dist/index.js CHANGED
@@ -16,5 +16,16 @@ function createFailedRequest(error) {
16
16
  };
17
17
  }
18
18
 
19
+ // Copyright (c) Microsoft Corporation.
20
+ // Licensed under the MIT license.
21
+ /** Helper function to create a provider claims for token */
22
+ function createProvideClaimsForToken(claims) {
23
+ return {
24
+ actionType: "microsoft.graph.ProvideClaimsForToken",
25
+ claims: claims,
26
+ };
27
+ }
28
+
19
29
  exports.createFailedRequest = createFailedRequest;
30
+ exports.createProvideClaimsForToken = createProvideClaimsForToken;
20
31
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/events.ts"],"sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/**\n * Abstract base event interface to house common event request attributes.\n */\nexport interface AuthenticationEventRequestCommon {\n /** Related Type */\n type: string;\n /** The status of the current request, see RequestStatus. */\n requestStatus: RequestStatus;\n /** A user friendly message (containing errors), that the authentication event returns. */\n statusMessage: string;\n /** A dictionary of query string parameters */\n queryParameters: Record<string, string>;\n}\n\n/**\n * Event request interface extended the related response and event data (payload) objects.\n */\nexport interface AuthenticationEventRequest<\n TResponse extends AuthenticationEventResponse,\n TData extends AuthenticationEventData\n> extends AuthenticationEventRequestCommon {\n /** Related IEventResponse */\n response: TResponse;\n /** Related IEventData */\n payload: TData;\n}\n\n/**\n * Event request interface extended the related response and event data (payload) objects for cloud events.\n */\nexport interface CloudEventRequest<\n TResponse extends AuthenticationEventResponse,\n TData extends AuthenticationEventData\n> extends AuthenticationEventRequest<TResponse, TData> {\n /** Related Source */\n source: string;\n /** Related \\@odata.type */\n oDataType: string;\n}\n\n/**\n * Event response interface that houses attributes returned from the authentication events trigger.\n */\nexport interface AuthenticationEventResponse {\n /** A template of the body of the expected response. */\n body: string;\n}\n\n/**\n * Event data interface pertaining to the expected payload, this interface houses the common attributes for data events.\n */\nexport interface AuthenticationEventData {\n /** Tenant the request is related to. */\n tenantId: string;\n /** Unique Id for the event. */\n authenticationEventListenerId: string;\n /** The unique internal Id of the registered custom extension. */\n customAuthenticationExtensionId: string;\n}\n\n/**\n * An interface that binds a response that has actions\n */\nexport interface ActionableResponse<TEventAction extends AuthenticationEventAction>\n extends AuthenticationEventResponse {\n /** Collections of actions pertaining to the event. */\n actions: TEventAction[];\n}\n\n/**\n * An interface for any responses that implement an cloud event payload and has actions on it.\n */\nexport interface ActionableCloudEventResponse<TEventAction extends AuthenticationEventAction>\n extends ActionableResponse<TEventAction> {\n /** Gets the Cloud Event \\@odata.type. */\n oDataType: string;\n}\n\n/**\n * An interface representing an action for an event.\n */\nexport interface AuthenticationEventAction {\n /** Must be overridden, this will be the 'Name' of the action in the JSON. */\n actionType: string;\n}\n\n/**\n * The status of the request.\n */\nexport type RequestStatus = \"Failed\" | \"TokenInvalid\" | \"Successful\";\n\n/**\n * Return the correctly formatted error\n * */\nexport interface FailedRequest extends AuthenticationEventResponse {\n //* * The error that caused the request to fail. */\n error: string;\n}\n\n/**\n * Helper function to create a files request\n * @param error - string or exception\n * @returns a valid FailedRequest object\n */\nexport function createFailedRequest(error: unknown): FailedRequest {\n return {\n body: \"\",\n error: error instanceof Error ? error.message : String(error),\n };\n}\n"],"names":[],"mappings":";;;;AAAA;AACA;AAqGA;;;;AAIG;AACG,SAAU,mBAAmB,CAAC,KAAc,EAAA;IAChD,OAAO;AACL,QAAA,IAAI,EAAE,EAAE;AACR,QAAA,KAAK,EAAE,KAAK,YAAY,KAAK,GAAG,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC;KAC9D,CAAC;AACJ;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../src/events.ts","../src/tokenIssuanceStart/actions.ts"],"sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/**\n * Abstract base event interface to house common event request attributes.\n */\nexport interface AuthenticationEventRequestCommon {\n /** Related Type */\n type: string;\n /** The status of the current request, see RequestStatus. */\n requestStatus: RequestStatus;\n /** A user friendly message (containing errors), that the authentication event returns. */\n statusMessage: string;\n /** A dictionary of query string parameters */\n queryParameters: Record<string, string>;\n}\n\n/**\n * Event request interface extended the related response and event data (payload) objects.\n */\nexport interface AuthenticationEventRequest<\n TResponse extends AuthenticationEventResponse,\n TData extends AuthenticationEventData\n> extends AuthenticationEventRequestCommon {\n /** Related IEventResponse */\n response: TResponse;\n /** Related IEventData */\n payload: TData;\n}\n\n/**\n * Event request interface extended the related response and event data (payload) objects for cloud events.\n */\nexport interface CloudEventRequest<\n TResponse extends AuthenticationEventResponse,\n TData extends AuthenticationEventData\n> extends AuthenticationEventRequest<TResponse, TData> {\n /** Related Source */\n source: string;\n /** Related \\@odata.type */\n oDataType: string;\n}\n\n/**\n * Event response interface that houses attributes returned from the authentication events trigger.\n */\nexport interface AuthenticationEventResponse {\n /** A template of the body of the expected response. */\n body: string;\n}\n\n/**\n * Event data interface pertaining to the expected payload, this interface houses the common attributes for data events.\n */\nexport interface AuthenticationEventData {\n /** Tenant the request is related to. */\n tenantId: string;\n /** Unique Id for the event. */\n authenticationEventListenerId: string;\n /** The unique internal Id of the registered custom extension. */\n customAuthenticationExtensionId: string;\n}\n\n/**\n * An interface that binds a response that has actions\n */\nexport interface ActionableResponse<TEventAction extends AuthenticationEventAction>\n extends AuthenticationEventResponse {\n /** Collections of actions pertaining to the event. */\n actions: TEventAction[];\n}\n\n/**\n * An interface for any responses that implement an cloud event payload and has actions on it.\n */\nexport interface ActionableCloudEventResponse<TEventAction extends AuthenticationEventAction>\n extends ActionableResponse<TEventAction> {\n /** Gets the Cloud Event \\@odata.type. */\n oDataType: string;\n}\n\n/**\n * An interface representing an action for an event.\n */\nexport interface AuthenticationEventAction {\n /** Must be overridden, this will be the 'Name' of the action in the JSON. */\n actionType: string;\n}\n\n/**\n * The status of the request.\n */\nexport type RequestStatus = \"Failed\" | \"TokenInvalid\" | \"Successful\";\n\n/**\n * Return the correctly formatted error\n * */\nexport interface FailedRequest extends AuthenticationEventResponse {\n //* * The error that caused the request to fail. */\n error: string;\n}\n\n/**\n * Helper function to create a files request\n * @param error - string or exception\n * @returns a valid FailedRequest object\n */\nexport function createFailedRequest(error: unknown): FailedRequest {\n return {\n body: \"\",\n error: error instanceof Error ? error.message : String(error),\n };\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { TokenIssuanceStartAction } from \"./context\";\n\n/**\n * An Interface for the Provide Claims for token action.\n */\nexport interface ProvideClaimsForToken extends TokenIssuanceStartAction {\n /** The 'Name' of the action in the JSON. */\n actionType: \"microsoft.graph.ProvideClaimsForToken\";\n /** Collection of claims to add to the token. */\n claims: TokenClaim;\n /** Helper constructor to easily add claims to the action. */\n}\n\n/** Helper function to create a provider claims for token */\nexport function createProvideClaimsForToken(claims: TokenClaim): ProvideClaimsForToken {\n return {\n actionType: \"microsoft.graph.ProvideClaimsForToken\",\n claims: claims,\n };\n}\n\n/**\n * An type representing a claim.\n */\nexport type TokenClaim = Record<string, string | string[]>;\n"],"names":[],"mappings":";;;;AAAA;AACA;AAqGA;;;;AAIG;AACG,SAAU,mBAAmB,CAAC,KAAc,EAAA;IAChD,OAAO;AACL,QAAA,IAAI,EAAE,EAAE;AACR,QAAA,KAAK,EAAE,KAAK,YAAY,KAAK,GAAG,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC;KAC9D,CAAC;AACJ;;AChHA;AACA;AAeA;AACM,SAAU,2BAA2B,CAAC,MAAkB,EAAA;IAC5D,OAAO;AACL,QAAA,UAAU,EAAE,uCAAuC;AACnD,QAAA,MAAM,EAAE,MAAM;KACf,CAAC;AACJ;;;;;"}
@@ -1,4 +1,5 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
2
  // Licensed under the MIT license.
3
3
  export { createFailedRequest, } from "./events";
4
+ export { createProvideClaimsForToken, } from "./tokenIssuanceStart/actions";
4
5
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAUL,mBAAmB,GAEpB,MAAM,UAAU,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nexport {\n FailedRequest,\n ActionableResponse,\n AuthenticationEventAction,\n AuthenticationEventData,\n AuthenticationEventRequest,\n AuthenticationEventRequestCommon,\n AuthenticationEventResponse,\n RequestStatus,\n CloudEventRequest,\n createFailedRequest,\n ActionableCloudEventResponse,\n} from \"./events\";\n\nexport {\n AuthenticationEventContext,\n AuthenticationEventContextClient,\n AuthenticationEventContextServicePrincipal,\n AuthenticationEventContextUser,\n TokenIssuanceStartData,\n TokenIssuanceStartRequest,\n TokenIssuanceStartResponse,\n} from \"./tokenIssuanceStart/context\";\nexport { ProvideClaimsForToken, TokenClaim } from \"./tokenIssuanceStart/actions\";\n\nexport { TokenIssuanceStartAction } from \"./tokenIssuanceStart/context\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAUL,mBAAmB,GAEpB,MAAM,UAAU,CAAC;AAWlB,OAAO,EAGL,2BAA2B,GAC5B,MAAM,8BAA8B,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nexport {\n FailedRequest,\n ActionableResponse,\n AuthenticationEventAction,\n AuthenticationEventData,\n AuthenticationEventRequest,\n AuthenticationEventRequestCommon,\n AuthenticationEventResponse,\n RequestStatus,\n CloudEventRequest,\n createFailedRequest,\n ActionableCloudEventResponse,\n} from \"./events\";\n\nexport {\n AuthenticationEventContext,\n AuthenticationEventContextClient,\n AuthenticationEventContextServicePrincipal,\n AuthenticationEventContextUser,\n TokenIssuanceStartData,\n TokenIssuanceStartRequest,\n TokenIssuanceStartResponse,\n} from \"./tokenIssuanceStart/context\";\nexport {\n ProvideClaimsForToken,\n TokenClaim,\n createProvideClaimsForToken,\n} from \"./tokenIssuanceStart/actions\";\n\nexport { TokenIssuanceStartAction } from \"./tokenIssuanceStart/context\";\n"]}
@@ -1,4 +1,10 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
2
  // Licensed under the MIT license.
3
- export {};
3
+ /** Helper function to create a provider claims for token */
4
+ export function createProvideClaimsForToken(claims) {
5
+ return {
6
+ actionType: "microsoft.graph.ProvideClaimsForToken",
7
+ claims: claims,
8
+ };
9
+ }
4
10
  //# sourceMappingURL=actions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"actions.js","sourceRoot":"","sources":["../../../src/tokenIssuanceStart/actions.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { TokenIssuanceStartAction } from \"./context\";\n\n/**\n * An Interface for the Provide Claims for token action.\n */\nexport interface ProvideClaimsForToken extends TokenIssuanceStartAction {\n /** The 'Name' of the action in the JSON. */\n actionType: \"ProvideClaimsForToken\";\n /** Collection of claims to add to the token. */\n claims: TokenClaim[];\n /** Helper constructor to easily add claims to the action. */\n}\n\n/**\n * An Interface representing a claim.\n */\nexport interface TokenClaim {\n /** The id of the claim (i.e. Name). */\n id: string;\n /** The value of the claim. */\n value: string | string[];\n}\n"]}
1
+ {"version":3,"file":"actions.js","sourceRoot":"","sources":["../../../src/tokenIssuanceStart/actions.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAelC,4DAA4D;AAC5D,MAAM,UAAU,2BAA2B,CAAC,MAAkB;IAC5D,OAAO;QACL,UAAU,EAAE,uCAAuC;QACnD,MAAM,EAAE,MAAM;KACf,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { TokenIssuanceStartAction } from \"./context\";\n\n/**\n * An Interface for the Provide Claims for token action.\n */\nexport interface ProvideClaimsForToken extends TokenIssuanceStartAction {\n /** The 'Name' of the action in the JSON. */\n actionType: \"microsoft.graph.ProvideClaimsForToken\";\n /** Collection of claims to add to the token. */\n claims: TokenClaim;\n /** Helper constructor to easily add claims to the action. */\n}\n\n/** Helper function to create a provider claims for token */\nexport function createProvideClaimsForToken(claims: TokenClaim): ProvideClaimsForToken {\n return {\n actionType: \"microsoft.graph.ProvideClaimsForToken\",\n claims: claims,\n };\n}\n\n/**\n * An type representing a claim.\n */\nexport type TokenClaim = Record<string, string | string[]>;\n"]}
@@ -1,4 +1,4 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
2
  // Licensed under the MIT license.
3
- export {};
3
+ export { createProvideClaimsForToken } from "./actions";
4
4
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tokenIssuanceStart/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nexport {\n AuthenticationEventContext,\n AuthenticationEventContextClient,\n AuthenticationEventContextServicePrincipal,\n AuthenticationEventContextUser,\n TokenIssuanceStartData,\n TokenIssuanceStartRequest,\n TokenIssuanceStartResponse,\n TokenIssuanceStartAction,\n} from \"./context\";\nexport { ProvideClaimsForToken, TokenClaim } from \"./actions\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tokenIssuanceStart/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAYlC,OAAO,EAAqC,2BAA2B,EAAE,MAAM,WAAW,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nexport {\n AuthenticationEventContext,\n AuthenticationEventContextClient,\n AuthenticationEventContextServicePrincipal,\n AuthenticationEventContextUser,\n TokenIssuanceStartData,\n TokenIssuanceStartRequest,\n TokenIssuanceStartResponse,\n TokenIssuanceStartAction,\n} from \"./context\";\nexport { ProvideClaimsForToken, TokenClaim, createProvideClaimsForToken } from \"./actions\";\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azure/functions-authentication-events",
3
- "version": "1.0.0-alpha.20221101.1",
3
+ "version": "1.0.0-beta.2",
4
4
  "description": "Typescript Trigger SDK for Azure AD Authentication event custom extensions. Lets you focus on your business logic.",
5
5
  "sdk-type": "client",
6
6
  "main": "dist/index.js",
@@ -65,11 +65,11 @@
65
65
  "tslib": "^2.2.0"
66
66
  },
67
67
  "devDependencies": {
68
- "@azure/dev-tool": ">=1.0.0-alpha <1.0.0-alphb",
69
- "@azure/eslint-plugin-azure-sdk": ">=3.0.0-alpha <3.0.0-alphb",
68
+ "@azure/dev-tool": "^1.0.0",
69
+ "@azure/eslint-plugin-azure-sdk": "^3.0.0",
70
70
  "@azure/identity": "^2.0.1",
71
- "@azure/test-utils": ">=1.0.0-alpha <1.0.0-alphb",
72
- "@azure-tools/test-credential": ">=1.0.0-alpha <1.0.0-alphb",
71
+ "@azure/test-utils": "^1.0.0",
72
+ "@azure-tools/test-credential": "~1.0.0",
73
73
  "@azure-tools/test-recorder": "^2.0.0",
74
74
  "@microsoft/api-extractor": "^7.31.1",
75
75
  "@types/chai": "^4.1.6",
@@ -148,6 +148,8 @@ export declare interface CloudEventRequest<TResponse extends AuthenticationEvent
148
148
  * @returns a valid FailedRequest object
149
149
  */
150
150
  export declare function createFailedRequest(error: unknown): FailedRequest;
151
+ /** Helper function to create a provider claims for token */
152
+ export declare function createProvideClaimsForToken(claims: TokenClaim): ProvideClaimsForToken;
151
153
  /**
152
154
  * Return the correctly formatted error
153
155
  * */
@@ -159,23 +161,18 @@ export declare interface FailedRequest extends AuthenticationEventResponse {
159
161
  */
160
162
  export declare interface ProvideClaimsForToken extends TokenIssuanceStartAction {
161
163
  /** The 'Name' of the action in the JSON. */
162
- actionType: "ProvideClaimsForToken";
164
+ actionType: "microsoft.graph.ProvideClaimsForToken";
163
165
  /** Collection of claims to add to the token. */
164
- claims: TokenClaim[];
166
+ claims: TokenClaim;
165
167
  }
166
168
  /**
167
169
  * The status of the request.
168
170
  */
169
171
  export declare type RequestStatus = "Failed" | "TokenInvalid" | "Successful";
170
172
  /**
171
- * An Interface representing a claim.
173
+ * An type representing a claim.
172
174
  */
173
- export declare interface TokenClaim {
174
- /** The id of the claim (i.e. Name). */
175
- id: string;
176
- /** The value of the claim. */
177
- value: string | string[];
178
- }
175
+ export declare type TokenClaim = Record<string, string | string[]>;
179
176
  /**
180
177
  * All actions for the token issuance start event should extended this interface, as it looks the correct action to the correct event.
181
178
  */
@@ -161,6 +161,9 @@ export declare interface CloudEventRequest<TResponse extends AuthenticationEvent
161
161
  */
162
162
  export declare function createFailedRequest(error: unknown): FailedRequest;
163
163
 
164
+ /** Helper function to create a provider claims for token */
165
+ export declare function createProvideClaimsForToken(claims: TokenClaim): ProvideClaimsForToken;
166
+
164
167
  /**
165
168
  * Return the correctly formatted error
166
169
  * */
@@ -173,9 +176,9 @@ export declare interface FailedRequest extends AuthenticationEventResponse {
173
176
  */
174
177
  export declare interface ProvideClaimsForToken extends TokenIssuanceStartAction {
175
178
  /** The 'Name' of the action in the JSON. */
176
- actionType: "ProvideClaimsForToken";
179
+ actionType: "microsoft.graph.ProvideClaimsForToken";
177
180
  /** Collection of claims to add to the token. */
178
- claims: TokenClaim[];
181
+ claims: TokenClaim;
179
182
  }
180
183
 
181
184
  /**
@@ -184,14 +187,9 @@ export declare interface ProvideClaimsForToken extends TokenIssuanceStartAction
184
187
  export declare type RequestStatus = "Failed" | "TokenInvalid" | "Successful";
185
188
 
186
189
  /**
187
- * An Interface representing a claim.
190
+ * An type representing a claim.
188
191
  */
189
- export declare interface TokenClaim {
190
- /** The id of the claim (i.e. Name). */
191
- id: string;
192
- /** The value of the claim. */
193
- value: string | string[];
194
- }
192
+ export declare type TokenClaim = Record<string, string | string[]>;
195
193
 
196
194
  /**
197
195
  * All actions for the token issuance start event should extended this interface, as it looks the correct action to the correct event.