Skip to content

Commit 60a8dc2

Browse files
authored
Add security warning for anonymous negotation endpoint
1 parent 2e3dfeb commit 60a8dc2

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

articles/azure-functions/functions-bindings-signalr-service-input.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,9 @@ public SignalRConnectionInfo negotiate(
134134

135135
:::zone-end
136136

137+
> [!Warning]
138+
> For the simplicity, we have omitted the authentication and authorization parts in this example. As a result, this endpoint is publicly accessible without any restrictions. To ensure the security of your negotiation endpoint, you should implement appropriate authentication and authorization mechanisms based on your specific requirements. For guidance on protecting your HTTP endpoints, see [Secure HTTP endpoints](./security-concepts.md#secure-http-endpoints).
139+
137140
## Usage
138141

139142
### Authenticated tokens

articles/azure-signalr/signalr-concept-client-negotiation.md

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -200,22 +200,17 @@ You can find a full sample on how to use the Management SDK to redirect SignalR
200200

201201
### Azure SignalR Service function extension
202202

203-
When you use an Azure function app, you can work with the function extension. Here's a sample of using `SignalRConnectionInfo` to help you build the negotiation response:
203+
When you use an Azure function app, you can work with the function extension. Here's a sample of using `SignalRConnectionInfo` in C# isolated worker model to help you build the negotiation response:
204204

205-
```cs
206-
[FunctionName("negotiate")]
207-
public SignalRConnectionInfo Negotiate([HttpTrigger(AuthorizationLevel.Anonymous)]HttpRequest req)
208-
{
209-
var claims = GetClaims(req.Headers["Authorization"]);
210-
return Negotiate(
211-
claims.First(c => c.Type == ClaimTypes.NameIdentifier).Value,
212-
claims
213-
);
214-
}
215-
```
205+
:::code language="csharp" source="~/azure-functions-dotnet-worker/samples/Extensions/SignalR/SignalRNegotiationFunctions.cs" id="snippet_negotiate":::
206+
207+
> [!Warning]
208+
> For the simplicity, we omit the authentication and authorization parts in this sample. As a result, this endpoint is publicly accessible without any restrictions. To ensure the security of your negotiation endpoint, you should implement appropriate authentication and authorization mechanisms based on your specific requirements. For guidance on protecting your HTTP endpoints, see [Secure HTTP endpoints](../azure-functions/security-concepts.md#secure-http-endpoints).
216209
217210
Then your clients can request the function endpoint `https://<Your Function App Name>.azurewebsites.net/api/negotiate` to get the service URL and access token. You can find a full sample on [GitHub](https://github.com/aspnet/AzureSignalR-samples/tree/main/samples/BidirectionChat).
218211

212+
For `SignalRConnectionInfo` input binding samples in other languages, see [Azure Functions SignalR Service input binding](../azure-functions/functions-bindings-signalr-service-input.md).
213+
219214
### Self-exposing `/negotiate` endpoint
220215

221216
You could also expose the negotiation endpoint in your own server and return the negotiation response by yourself if you are using other languages.

0 commit comments

Comments
 (0)