Class LiveKitAuthorizer
Exchanges Matrix OpenID tokens for LiveKit access tokens to a call's room, as lk-jwt-service does: the user is verified with their homeserver; users of full-access homeservers may publish and get the room created, others only join rooms that exist.
Inherited Members
Namespace: Uniform.LiveKit.Authorization
Assembly: Uniform.LiveKit.Authorization.dll
Syntax
public sealed class LiveKitAuthorizer
Constructors
| Edit this page View SourceLiveKitAuthorizer(Func<LiveKitAuthorizerOptions>, IOpenIdVerifier, HttpClient, TimeProvider, ILogger<LiveKitAuthorizer>, IRoomMembership?, DelayedLeaveKeeper?)
Exchanges Matrix OpenID tokens for LiveKit access tokens to a call's room, as lk-jwt-service does: the user is verified with their homeserver; users of full-access homeservers may publish and get the room created, others only join rooms that exist.
Declaration
public LiveKitAuthorizer(Func<LiveKitAuthorizerOptions> options, IOpenIdVerifier verifier, HttpClient http, TimeProvider time, ILogger<LiveKitAuthorizer> logger, IRoomMembership? membership = null, DelayedLeaveKeeper? keeper = null)
Parameters
| Type | Name | Description |
|---|---|---|
| Func<LiveKitAuthorizerOptions> | options | The current settings, read at each request, so changes apply at once. |
| IOpenIdVerifier | verifier | Verifies OpenID tokens. |
| HttpClient | http | The client of LiveKit's room service. |
| TimeProvider | time | Clock of the tokens. |
| ILogger<LiveKitAuthorizer> | logger | Logger of the decisions. |
| IRoomMembership | membership | When given, only users joined to the Matrix room get tokens; lk-jwt-service does not check this, as it has no room state. |
| DelayedLeaveKeeper | keeper | When given, keeps the delayed leaves that full-access members hand over with |
Fields
| Edit this page View SourceDepartureTimeout
How long a room stays after its last participant left.
Declaration
public static readonly TimeSpan DepartureTimeout
Field Value
| Type | Description |
|---|---|
| TimeSpan |
EmptyTimeout
How long a created room waits for its first participant.
Declaration
public static readonly TimeSpan EmptyTimeout
Field Value
| Type | Description |
|---|---|
| TimeSpan |
Methods
| Edit this page View SourceAuthorizeAsync(TokenRequest, CancellationToken)
Return a token for request's member in its slot.
Declaration
public Task<SfuResponse> AuthorizeAsync(TokenRequest request, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| TokenRequest | request | |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<SfuResponse> |
AuthorizeLegacyAsync(LegacySfuRequest, CancellationToken)
Return a token for the legacy /sfu/get request, to the room's call.
Declaration
public Task<SfuResponse> AuthorizeLegacyAsync(LegacySfuRequest request, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| LegacySfuRequest | request | |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<SfuResponse> |
DelegateAsync(TokenRequest, CancellationToken)
Keep the delayed leave of request's member, as /delegate_delayed_leave asks: only for full access, and only with its delay_id and delay_timeout; the member is the participant /get_token makes it.
Declaration
public Task DelegateAsync(TokenRequest request, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| TokenRequest | request | |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task |
Exceptions
| Type | Condition |
|---|---|
| AuthorizationException | With M_BAD_JSON for missing fields, M_UNAUTHORIZED for a user that is not verified, and M_FORBIDDEN without full access or a keeper. |
ServerName(string)
Return the server name of a user ID @local:server, or null when it is not one.
Declaration
public static string? ServerName(string userId)
Parameters
| Type | Name | Description |
|---|---|---|
| string | userId |
Returns
| Type | Description |
|---|---|
| string |