You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Changed ElevenLabsClient to be IDisposable
- The ElevenLabsClient must now be disposed if you do not pass your own HttpClient
- Updated ElevenLabsClientSettings to accept custom domains
- Added filesystemless overloads for uploading audio clips
ElevenLabs-DotNet-Proxy 2.2.0
- Updated implementation to include WebApplication builder
---------
Co-authored-by: Stillkill <36937920+RealStillkill@users.noreply.github.com>
<Description>A simple Proxy API gateway for ElevenLabs-DotNet to make authenticated requests from a front end application without exposing your API keys.</Description>
<Description>A simple Proxy API gateway for ElevenLabs-DotNet to make authenticated requests from a front end application without exposing your API keys.</Description>
Copy file name to clipboardExpand all lines: ElevenLabs-DotNet-Proxy/Proxy/ElevenLabsProxyStartup.cs
+46-20Lines changed: 46 additions & 20 deletions
Original file line number
Diff line number
Diff line change
@@ -3,6 +3,7 @@
3
3
usingMicrosoft.AspNetCore.Builder;
4
4
usingMicrosoft.AspNetCore.Hosting;
5
5
usingMicrosoft.AspNetCore.Http;
6
+
usingMicrosoft.AspNetCore.Server.Kestrel.Core;
6
7
usingMicrosoft.Extensions.DependencyInjection;
7
8
usingMicrosoft.Extensions.Hosting;
8
9
usingMicrosoft.Net.Http.Headers;
@@ -26,7 +27,7 @@ public class ElevenLabsProxyStartup
26
27
privateIAuthenticationFilterauthenticationFilter;
27
28
28
29
// Copied from https://github.com/microsoft/reverse-proxy/blob/51d797986b1fea03500a1ad173d13a1176fb5552/src/ReverseProxy/Forwarder/RequestUtilities.cs#L61-L83
3. Create a new class that inherits from `AbstractAuthenticationFilter` and override the `ValidateAuthentication` method. This will implement the `IAuthenticationFilter` that you will use to check user session token against your internal server.
54
-
4. In `Program.cs`, create a new proxy web application by calling `ElevenLabsProxyStartup.CreateDefaultHost` method, passing your custom `AuthenticationFilter` as a type argument.
54
+
4. In `Program.cs`, create a new proxy web application by calling `ElevenLabsProxyStartup.CreateWebApplication` method, passing your custom `AuthenticationFilter` as a type argument.
55
55
5. Create `ElevenLabsAuthentication` and `ElevenLabsClientSettings` as you would normally with your API keys, org id, or Azure settings.
56
56
57
57
```csharp
@@ -63,7 +63,19 @@ public partial class Program
63
63
{
64
64
// You will need to implement your own class to properly test
65
65
// custom issued tokens you've setup for your end users.
66
-
if (!request["xi-api-key"].ToString().Contains(userToken))
66
+
if (!request["xi-api-key"].ToString().Contains(TestUserToken))
67
+
{
68
+
thrownewAuthenticationException("User is not authorized");
0 commit comments