authentication

package
v0.18.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 10, 2024 License: MIT Imports: 8 Imported by: 1

Documentation

Overview

Package auth contains variuos routines to generate and check STUNner authentication credentials.

Index

Constants

View Source
const UsernameSeparator = ":"

UsernameSeparator is the separator character used in time-windowed TURN authentication as defined in "REST API For Access To TURN Services" (https://datatracker.ietf.org/doc/html/draft-uberti-behave-turn-rest-00).

Variables

This section is empty.

Functions

func CheckTimeWindowedUsername

func CheckTimeWindowedUsername(username string) error

CheckTimeWindowedUsername checks the validity of an authentication credential. The method mostly follows the "REST API For Access To TURN Services" (https://datatracker.ietf.org/doc/html/draft-uberti-behave-turn-rest-00) spec with the exception that we make more effort to find out which component of the username is the UNIX timestamp: we find the first thing that looks like a UNIX timestamp in the username and use that for checking the time-windowed credential, and reject everything else.

func GenerateAuthKey

func GenerateAuthKey(username, realm, password string) []byte

GenerateAuthKey is a convenience function to easily generate keys in the format used by AuthHandler. Re-exported from `pion/turn` so that our callers will have a single import.

func GenerateTimeWindowedUsername

func GenerateTimeWindowedUsername(startTime time.Time, duration time.Duration, userid string) string

GenerateTimeWindowedUsername creates a time-windowed username consisting of a validity timestamp and an arbitrary user id, as per the "REST API For Access To TURN Services" (https://datatracker.ietf.org/doc/html/draft-uberti-behave-turn-rest-00) spec.

func GetLongTermCredential

func GetLongTermCredential(username string, sharedSecret string) (string, error)

GetLongTermCredential creates a password given a username and a shared secret.

Types

type AuthHandler added in v0.14.5

type AuthHandler = turn.AuthHandler

AuthHandler specifies type of the TURN authentication handler used in Stunner. Re-exported from pion/turn for completeness.

type PermissionHandler added in v0.14.5

type PermissionHandler = turn.PermissionHandler

PermissionHandler specifies type of the TURN permission handler used in Stunner. Re-exported from pion/turn for completeness.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL