mirror of
https://github.com/livekit/livekit.git
synced 2026-10-23 15:12:43 +00:00
Remove backwards compatibility support for TURN auth. (#4539)
This was indiecated in release v1.12.0 - https://github.com/livekit/livekit/releases/tag/v1.12.0
This commit is contained in:
1 parent
062d12197f
commit
2e22911dcd
3 files changed
+122
-38
No files matched your search
+16
-9
@@ -27,6 +27,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/jxskiss/base62"
|
||||
"github.com/pion/sdp/v3"
|
||||
"github.com/pion/stun/v3"
|
||||
"github.com/pion/turn/v5"
|
||||
@@ -1432,12 +1433,13 @@ func TestTurnAuthFailure(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
require.NotEqual(t, validPassword, mismatchedExpiryPassword)
|
||||
|
||||
// password whose hash was generated without an expiry component (the
|
||||
// pre-expiry form of the username/password pair); should not authenticate
|
||||
// against a username that carries an expiry.
|
||||
passwordWithoutExpiry, err := authHandler.CreatePassword(testApiKey, pID, 0)
|
||||
require.NoError(t, err)
|
||||
require.NotEqual(t, validPassword, passwordWithoutExpiry)
|
||||
// username carrying expiry=0 must be rejected outright; constructed
|
||||
// directly because CreateUsername always stamps a real expiry.
|
||||
zeroExpiryUsername := base62.EncodeToString(fmt.Appendf(nil, "%s|%s|%d", testApiKey, pID, 0))
|
||||
|
||||
// username with only apiKey|pID (no expiry component) is the legacy
|
||||
// pre-expiry form and must be rejected.
|
||||
twoPartUsername := base62.EncodeToString(fmt.Appendf(nil, "%s|%s", testApiKey, pID))
|
||||
|
||||
testCases := []struct {
|
||||
name string
|
||||
@@ -1470,9 +1472,14 @@ func TestTurnAuthFailure(t *testing.T) {
|
||||
password: mismatchedExpiryPassword,
|
||||
},
|
||||
{
|
||||
name: "password-missing-expiry",
|
||||
username: validUsername,
|
||||
password: passwordWithoutExpiry,
|
||||
name: "zero-expiry-username",
|
||||
username: zeroExpiryUsername,
|
||||
password: validPassword,
|
||||
},
|
||||
{
|
||||
name: "two-part-username",
|
||||
username: twoPartUsername,
|
||||
password: validPassword,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user