Skip to content

Commit d8574c2

Browse files
Merge pull request #291375 from Y-Sindo/security-warning
Add security warning for anonymous negotation endpoint
2 parents dda7a5d + d60b450 commit d8574c2

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

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

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

135135
:::zone-end
136136

137+
> [!Warning]
138+
> 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 the following articles:
139+
> * [Secure HTTP endpoints](../azure-functions/security-concepts.md#secure-http-endpoints).
140+
> * [Authentication and authorization in Azure App Service and Azure Functions](../app-service/overview-authentication-authorization.md)
141+
137142
## Usage
138143

139144
### Authenticated tokens

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

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -200,22 +200,19 @@ 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 the following articles:
209+
> * [Secure HTTP endpoints](../azure-functions/security-concepts.md#secure-http-endpoints).
210+
> * [Authentication and authorization in Azure App Service and Azure Functions](../app-service/overview-authentication-authorization.md)
216211
217212
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).
218213

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

221218
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)