Skip to content

Commit b14d810

Browse files
authored
Merge pull request #104171 from Rick-Kirkham/mostly-adding-links
Adding links and correcting 'document' term in AFR how to articles and quickstart
2 parents 27b2049 + 8869575 commit b14d810

File tree

5 files changed

+31
-29
lines changed

5 files changed

+31
-29
lines changed

articles/azure-fluid-relay/how-tos/azure-function-token-provider.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ The complete solution has two pieces:
3030

3131
### Create an endpoint for your TokenProvider using Azure Functions
3232

33-
Using [Azure Functions](../../azure-functions/functions-overview.md) is a fast way to create such an HTTPS endpoint. The example below implements that pattern in a class called **AzureFunctionTokenProvider**. It accepts the URL to your Azure Function, `userId` and`userName`. This specific implementation is also provided for you as an export from the `@fluidframework/azure-client` package.
33+
Using [Azure Functions](../../azure-functions/functions-overview.md) is a fast way to create such an HTTPS endpoint. The example below implements that pattern in a class called [AzureFunctionTokenProvider](https://fluidframework.com/docs/apis/azure-client/azurefunctiontokenprovider-class). It accepts the URL to your Azure Function, `userId` and`userName`.
3434

3535
This example demonstrates how to create your own **HTTPTrigger Azure Function** that fetches the token by passing in your tenant key.
3636

articles/azure-fluid-relay/how-tos/connect-fluid-azure-service.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: How to connect to an Azure Fluid Relay service using the @fluidfram
44
services: azure-fluid
55
author: hickeys
66
ms.author: hickeys
7-
ms.date: 10/05/2021
7+
ms.date: 01/18/2023
88
ms.topic: article
99
ms.service: azure-fluid
1010
fluid.url: https://fluidframework.com/docs/deployment/azure-frs/
@@ -17,16 +17,16 @@ This article walks through the steps to get your Azure Fluid Relay service provi
1717
> [!IMPORTANT]
1818
> Before you can connect your app to an Azure Fluid Relay server, you must [provision an Azure Fluid Relay server](provision-fluid-azure-portal.md) resource on your Azure account.
1919
20-
Azure Fluid Relay service is a cloud-hosted Fluid service. You can connect your Fluid application to an Azure Fluid Relay instance using the `AzureClient` in the `@fluidframework/azure-client` package. `AzureClient` handles the logic of connecting your [Fluid container](https://fluidframework.com/docs/build/containers/) to the service while keeping the container object itself service-agnostic. You can use one instance of this client to manage multiple containers.
20+
Azure Fluid Relay service is a cloud-hosted Fluid service. You can connect your Fluid application to an Azure Fluid Relay instance using the [AzureClient](https://fluidframework.com/docs/apis/azure-client/azureclient-class) in the [@fluidframework/azure-client](https://www.npmjs.com/package/@fluidframework/azure-client) package. `AzureClient` handles the logic of connecting your [Fluid container](https://fluidframework.com/docs/build/containers/) to the service while keeping the container object itself service-agnostic. You can use one instance of this client to manage multiple containers.
2121

2222
The sections below will explain how to use `AzureClient` in your own application.
2323

2424
## Connecting to the service
2525

26-
To connect to an Azure Fluid Relay instance, you first need to create an `AzureClient`. You must provide some configuration parameters including the tenant ID, service URL, and a token provider to generate the JSON Web Token (JWT) that will be used to authorize the current user against the service. The `@fluidframework/test-client-utils` package provides an `InsecureTokenProvider` that can be used for development purposes.
26+
To connect to an Azure Fluid Relay instance, you first need to create an `AzureClient`. You must provide some configuration parameters including the tenant ID, service URL, and a token provider to generate the JSON Web Token (JWT) that will be used to authorize the current user against the service. The [@fluidframework/test-client-utils](https://fluidframework.com/docs/apis/test-client-utils/) package provides an [InsecureTokenProvider](https://fluidframework.com/docs/apis/test-client-utils/insecuretokenprovider-class) that can be used for development purposes.
2727

2828
> [!CAUTION]
29-
> The `InsecureTokenProvider` should only be used for development purposes because **using it exposes the tenant key secret in your client-side code bundle.** This must be replaced with an implementation of `ITokenProvider` that fetches the token from your own backend service that is responsible for signing it with the tenant key.
29+
> The `InsecureTokenProvider` should only be used for development purposes because **using it exposes the tenant key secret in your client-side code bundle.** This must be replaced with an implementation of [ITokenProvider](https://fluidframework.com/docs/apis/azure-client/itokenprovider-interface/) that fetches the token from your own backend service that is responsible for signing it with the tenant key. An example implementation is [AzureFunctionTokenProvider](https://fluidframework.com/docs/apis/azure-client/azurefunctiontokenprovider-class). For more information, see [How to: Write a TokenProvider with an Azure Function](../how-tos/azure-function-token-provider.md).
3030
3131
```javascript
3232
const config = {
@@ -47,7 +47,7 @@ Now that you have an instance of `AzureClient`, you can start using it to create
4747

4848
### Token providers
4949

50-
The [AzureFunctionTokenProvider](https://github.com/microsoft/FluidFramework/blob/main/azure/packages/azure-client/src/AzureFunctionTokenProvider.ts) is an implementation of `ITokenProvider` that ensures your tenant key secret is not exposed in your client-side bundle code. The `AzureFunctionTokenProvider` takes in your Azure Function URL appended by `/api/GetAzureToken` along with the current user object. Later on, it makes a `GET` request to your Azure Function by passing in the tenantId, documentId and userId/userName as optional parameters.
50+
The [AzureFunctionTokenProvider](https://fluidframework.com/docs/apis/azure-client/azurefunctiontokenprovider-class) is an implementation of `ITokenProvider` that ensures your tenant key secret is not exposed in your client-side bundle code. The `AzureFunctionTokenProvider` takes in your Azure Function URL appended by `/api/GetAzureToken` along with the current user object. Later on, it makes a `GET` request to your Azure Function by passing in the tenantId, documentId and userId/userName as optional parameters.
5151

5252
```javascript
5353
const config = {
@@ -92,7 +92,7 @@ Your Azure Function will generate the token for the given user that is signed us
9292

9393
## Managing containers
9494

95-
The `AzureClient` API exposes `createContainer` and `getContainer` functions to create and get containers respectively. Both functions take in a _container schema_ that defines the container data model. For the `getContainer` function, there is an additional parameter for the container `id` of the container you wish to fetch.
95+
The `AzureClient` API exposes [createContainer](https://fluidframework.com/docs/apis/azure-client/azureclient-class#createcontainer-method) and [getContainer](https://fluidframework.com/docs/apis/azure-client/azureclient-class#getcontainer-method) functions to create and get [container](https://fluidframework.com/docs/apis/fluid-static/ifluidcontainer-interface)s respectively. Both functions take in a _container schema_ that defines the container data model. For the `getContainer` function, there is an additional parameter for the container `id` of the container you wish to fetch.
9696

9797
In the container creation scenario, you can use the following pattern:
9898

@@ -129,11 +129,11 @@ The container being fetched back will hold the `initialObjects` as defined in th
129129

130130
## Getting audience details
131131

132-
Calls to `createContainer` and `getContainer` return two values: a `container` -- described above -- and a `services` object.
132+
Calls to `createContainer` and `getContainer` return two values: a `container` -- described above -- and a [services](https://fluidframework.com/docs/apis/azure-client/azurecontainerservices-interface) object.
133133

134-
The `container` contains the Fluid data model and is service-agnostic. Any code you write against this container object returned by the `AzureClient` is reusable with the client for another service. An example is if you prototyped your scenario using `TinyliciousClient`, then all of your code interacting with the shared objects within the Fluid container can be reused when moving to using `AzureClient`.
134+
The `container` contains the Fluid data model and is service-agnostic. Any code you write against this container object returned by the `AzureClient` is reusable with the client for another service. An example is if you prototyped your scenario using [TinyliciousClient](https://fluidframework.com/docs/apis/tinylicious-client/), then all of your code interacting with the shared objects within the Fluid container can be reused when moving to using `AzureClient`.
135135

136-
The `services` object contains data that is specific to the Azure Fluid Relay service. This object contains an `audience` value that can be used to manage the roster of users that are currently connected to the container.
136+
The `services` object contains data that is specific to the Azure Fluid Relay service. This object contains an [audience](https://fluidframework.com/docs/apis/azure-client/azurecontainerservices-interface#audience-propertysignature) value that can be used to manage the roster of users that are currently connected to the container.
137137

138138
The following code demonstrates how you can use the `audience` object to maintain an updated view of all the members currently in a container.
139139

@@ -168,7 +168,7 @@ onAudienceChanged();
168168
audience.on("membersChanged", onAudienceChanged);
169169
```
170170

171-
`audience` provides two functions that will return `AzureMember` objects that have a user ID and user name:
171+
`audience` provides two functions that will return [AzureMember](https://fluidframework.com/docs/apis/azure-client/azuremember-interface) objects that have a user ID and user name:
172172

173173
- `getMembers` returns a map of all the users connected to the container. These values will change anytime a member joins or leaves the container.
174174
- `getMyself` returns the current user on this client.
@@ -198,7 +198,7 @@ A sample `AzureMember` object looks like:
198198
}
199199
```
200200

201-
Alongside the user ID, name and additional details, `AzureMember` objects also hold an array of `connections`. If the user is logged into the session with only one client, `connections` will only have one value in it with the ID of the client, and whether is in read/write mode. However, if the same user is logged in from multiple clients (that is, they are logged in from different devices or have multiple browser tabs open with the same container), `connections` here will hold multiple values for each client. In the example data above, we can see that a user with name "Test User" and ID "0e662aca-9d7d-4ff0-8faf-9f8672b70f15" currently has the container open from two different clients. The values in the `additionalDetails` field match up to the values provided in the `AzureFunctionTokenProvider` token generation.
201+
Alongside the user ID, name and additional details, `AzureMember` objects also hold an array of [connections](https://fluidframework.com/docs/apis/fluid-static/imember-interface#connections-propertysignature). If the user is logged into the session with only one client, `connections` will only have one value in it with the ID of the client, and whether is in read/write mode. However, if the same user is logged in from multiple clients (that is, they are logged in from different devices or have multiple browser tabs open with the same container), `connections` here will hold multiple values for each client. In the example data above, we can see that a user with name "Test User" and ID "0e662aca-9d7d-4ff0-8faf-9f8672b70f15" currently has the container open from two different clients. The values in the [additionalDetails](https://fluidframework.com/docs/apis/azure-client/azuremember-interface#additionaldetails-propertysignature) field match up to the values provided in the `AzureFunctionTokenProvider` token generation.
202202

203203
These functions and events can be combined to present a real-time view of the users in the current session.
204204

articles/azure-fluid-relay/how-tos/provision-fluid-azure-portal.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: How to provision an Azure Fluid Relay service using the Azure porta
44
services: azure-fluid
55
author: hickeys
66
ms.author: hickeys
7-
ms.date: 10/05/2021
7+
ms.date: 01/18/2023
88
ms.topic: article
99
ms.service: azure-fluid
1010
ms.custom: references_regions
@@ -26,7 +26,7 @@ A resource group is a logical collection of Azure resources. All resources are d
2626

2727
:::image type="content" source="../images/add-resource-group.png" alt-text="A screenshot of the Resource Groups page on the Azure portal.":::
2828

29-
3. For Subscription, select the name of the Azure subscription in which you want to create the resource group.
29+
3. For Subscription, select the name of the Azure subscription in which you want to create the [resource group](../../azure-resource-manager/management/manage-resource-groups-portal.md#what-is-a-resource-group). For more information about subscriptions, see [Describe core Azure architectural components](/training/modules/azure-architecture-fundamentals).
3030

3131
:::image type="content" source="../images/create-resource-group.png" alt-text="A screenshot of the Create Resource Group page on the Azure portal.":::
3232

@@ -71,4 +71,4 @@ Each Azure Fluid Relay server resource provides a tenant for you to use in your
7171
:::image type="content" source="../images/resource-details.png" alt-text="A screenshot of an example details page for a deployed Fluid Relay resource.":::
7272

7373
## Next steps
74-
You just created a resource group and a provisioned an Azure Fluid Relay resource in that group. Next, you can [connect to your Azure Fluid Relay service in your app](../quickstarts/quickstart-dice-roll.md).
74+
You just created a resource group and a provisioned an Azure Fluid Relay resource in that group. Next, you can [connect to your Azure Fluid Relay service in your app](../how-tos/connect-fluid-azure-service.md).

articles/azure-fluid-relay/how-tos/validate-document-creator.md

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
---
2-
title: "How to: Validate a User Created a Document"
3-
description: How to validate that the user who created a document is the same user who is claiming to be creating the document.
2+
title: "How to: Validate a user who created a container"
3+
description: How to validate that the user who created a container is the same user who is claiming to be accessing the container.
44
services: azure-fluid
55
author: hickeys
66
ms.author: hickeys
7-
ms.date: 04/05/2022
7+
ms.date: 01/18/2023
88
ms.topic: reference
99
ms.service: azure-fluid
1010
fluid.url: https://fluidframework.com/docs/apis/azure-client/itokenprovider/
1111
---
1212

13-
# How to: Validate a User Created a Document
13+
# How to: Validate a user who created a container
1414

15-
When you create a document in Azure Fluid Relay, the JWT provided by the [ITokenProvider](https://fluidframework.com/docs/apis/azure-client/itokenprovider-interface) for the creation request can only be used once. After creating a document, the client must generate a new JWT that contains the document ID provided by the service at creation time. If an application has an authorization service that manages document access control, it will need to know who created a document with a given ID in order to authorize the generation of a new JWT for access to that document.
15+
When you create a container in Azure Fluid Relay, the JWT provided by the [ITokenProvider](https://fluidframework.com/docs/apis/azure-client/itokenprovider-interface) for the creation request can only be used once. After creating a container, the client must generate a new JWT that contains the document ID (which is really the container ID) provided by the service at creation time. If an application has an authorization service that manages container access control, it will need to know who created a container with a given ID in order to authorize the generation of a new JWT for access to that container.
1616

17-
## Inform an Authorization Service when a document is Created
17+
## Inform an authorization service when a container is created
1818

19-
An application can tie into the document creation lifecycle by implementing a public [documentPostCreateCallback()](https://fluidframework.com/docs/apis/azure-client/itokenprovider-interface#documentpostcreatecallback-methodsignature) method in its `TokenProvider`. This callback will be triggered directly after creating the document, before a client requests the new JWT it needs to gain read/write permissions to the document that was created.
19+
An application can tie into the container creation lifecycle by implementing a public [documentPostCreateCallback()](https://fluidframework.com/docs/apis/azure-client/itokenprovider-interface#documentpostcreatecallback-methodsignature) method in its `TokenProvider`. (The name of this function can be confusing. It is really a callback for post *container* creation.) This callback will be triggered directly after creating the container, before a client requests the new JWT it needs to gain read/write permissions to the container that was created.
2020

21-
The `documentPostCreateCallback()` receives two parameters: 1) the ID of the document that was created and 2) a JWT signed by the service with no permission scopes. The authorization service can verify the given JWT and use the information in the JWT to grant the correct user permissions for the newly created document.
21+
The `documentPostCreateCallback()` receives two parameters: 1) the ID of the container that was created (also called the "document ID") and 2) a JWT signed by the service with no permission scopes. The authorization service can verify the given JWT and use the information in the JWT to grant the correct user permissions for the newly created container.
2222

23-
### Create an endpoint for your document creation callback
23+
### Create an endpoint for your container creation callback
2424

2525
This example below is an [Azure Function](../../azure-functions/functions-overview.md) based off the example in [How to: Write a TokenProvider with an Azure Function](azure-function-token-provider.md#create-an-endpoint-for-your-tokenprovider-using-azure-functions).
2626

@@ -94,7 +94,7 @@ const httpTrigger: AzureFunction = async function (context: Context, req: HttpRe
9494

9595
const user: IUser = claims.user;
9696
// Pseudo-function: implement according to your needs
97-
giveUserPermissionsForDocument(documentId, user);
97+
giveUserPermissionsForContainer(documentId, user);
9898

9999
context.res = {
100100
status: 200,
@@ -117,7 +117,7 @@ import axios from "axios";
117117
* Token Provider implementation for connecting to an Azure Function endpoint for
118118
* Azure Fluid Relay token resolution.
119119
*/
120-
export class AzureFunctionTokenProviderWithDocumentCreateCallback extends AzureFunctionTokenProvider {
120+
export class AzureFunctionTokenProviderWithContainerCreateCallback extends AzureFunctionTokenProvider {
121121
/**
122122
* Creates a new instance using configuration parameters.
123123
* @param azFunctionUrl - URL to Azure Function endpoint
@@ -131,6 +131,8 @@ export class AzureFunctionTokenProviderWithDocumentCreateCallback extends AzureF
131131
super(azFunctionUrl, user);
132132
}
133133

134+
// In this context, a document is another name for container, so you can think of this function
135+
// as if it were named containerPostCreateCallback.
134136
public async documentPostCreateCallback?(documentId: string, creationToken: string): Promise<void> {
135137
await axios.post(this.authAzFunctionUrl, {
136138
params: {

0 commit comments

Comments
 (0)