Backend: fix IPv6 address parsing erroneous (#28585)

* Backend: Fix parsing of client IP address

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
This commit is contained in:
taciomcostaandArve Knudsen authored and GitHub committed 2020-11-25 07:55:22 +01:00
1 parent 3d33de1751
commit 10ff4eecef
15 files changed
+228 -147

No files matched your search

+3 -2
View File
@@ -3,6 +3,7 @@ package models
import (
"context"
"errors"
"net"
)
// Typed errors
@@ -32,9 +33,9 @@ type RevokeAuthTokenCmd struct {
// UserTokenService are used for generating and validating user tokens
type UserTokenService interface {
CreateToken(ctx context.Context, userId int64, clientIP, userAgent string) (*UserToken, error)
CreateToken(ctx context.Context, userId int64, clientIP net.IP, userAgent string) (*UserToken, error)
LookupToken(ctx context.Context, unhashedToken string) (*UserToken, error)
TryRotateToken(ctx context.Context, token *UserToken, clientIP, userAgent string) (bool, error)
TryRotateToken(ctx context.Context, token *UserToken, clientIP net.IP, userAgent string) (bool, error)
RevokeToken(ctx context.Context, token *UserToken) error
RevokeAllUserTokens(ctx context.Context, userId int64) error
ActiveTokenCount(ctx context.Context) (int64, error)