mirror of
https://github.com/strukturag/nextcloud-spreed-signaling
synced 2024-05-03 22:33:10 +02:00
Stop using deprecated "jwt.StandardClaims".
This commit is contained in:
parent
8a97fa7f5e
commit
924fce6713
|
@ -127,7 +127,7 @@ func (r *ProxyServerMessage) CloseAfterSend(session Session) bool {
|
|||
// Type "hello"
|
||||
|
||||
type TokenClaims struct {
|
||||
jwt.StandardClaims
|
||||
jwt.RegisteredClaims
|
||||
}
|
||||
|
||||
type HelloProxyClientMessage struct {
|
||||
|
|
|
@ -951,8 +951,8 @@ func (c *mcuProxyConnection) sendHello() error {
|
|||
msg.Hello.ResumeId = c.sessionId
|
||||
} else {
|
||||
claims := &TokenClaims{
|
||||
jwt.StandardClaims{
|
||||
IssuedAt: time.Now().Unix(),
|
||||
jwt.RegisteredClaims{
|
||||
IssuedAt: jwt.NewNumericDate(time.Now()),
|
||||
Issuer: c.proxy.tokenId,
|
||||
},
|
||||
}
|
||||
|
|
|
@ -890,7 +890,7 @@ func (s *ProxyServer) NewSession(hello *signaling.HelloProxyClientMessage) (*Pro
|
|||
}
|
||||
|
||||
minIssuedAt := time.Now().Add(-maxTokenAge)
|
||||
if issuedAt := time.Unix(claims.IssuedAt, 0); issuedAt.Before(minIssuedAt) {
|
||||
if issuedAt := claims.IssuedAt; issuedAt != nil && issuedAt.Before(minIssuedAt) {
|
||||
statsTokenErrorsTotal.WithLabelValues("expired").Inc()
|
||||
return nil, TokenExpired
|
||||
}
|
||||
|
|
|
@ -96,8 +96,8 @@ func TestTokenInFuture(t *testing.T) {
|
|||
server, key := newProxyServerForTest(t)
|
||||
|
||||
claims := &signaling.TokenClaims{
|
||||
StandardClaims: jwt.StandardClaims{
|
||||
IssuedAt: time.Now().Add(time.Hour).Unix(),
|
||||
RegisteredClaims: jwt.RegisteredClaims{
|
||||
IssuedAt: jwt.NewNumericDate(time.Now().Add(time.Hour)),
|
||||
Issuer: TokenIdForTest,
|
||||
},
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue