mirror of
https://github.com/datarhei/core.git
synced 2025-10-06 00:17:07 +08:00
Loosen restrictions for IAM user names
The only restriction for an IAM username is that it cannot start with a '$'. An username that contains a ':' must escape it with another ':' for use in a token for RTMP or SRT.
This commit is contained in:
11
srt/srt.go
11
srt/srt.go
@@ -10,6 +10,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/datarhei/core/v16/cluster/proxy"
|
||||
enctoken "github.com/datarhei/core/v16/encoding/token"
|
||||
"github.com/datarhei/core/v16/iam"
|
||||
iamidentity "github.com/datarhei/core/v16/iam/identity"
|
||||
"github.com/datarhei/core/v16/log"
|
||||
@@ -493,15 +494,11 @@ func (s *server) findIdentityFromToken(key string) (string, error) {
|
||||
var identity iamidentity.Verifier
|
||||
var err error
|
||||
|
||||
var token string
|
||||
|
||||
before, after, found := strings.Cut(key, ":")
|
||||
if !found {
|
||||
username, token := enctoken.Unmarshal(key)
|
||||
if len(username) == 0 {
|
||||
identity = s.iam.GetDefaultVerifier()
|
||||
token = before
|
||||
} else {
|
||||
identity, err = s.iam.GetVerifier(before)
|
||||
token = after
|
||||
identity, err = s.iam.GetVerifier(username)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user