2022-07-17 18:16:00 +00:00
|
|
|
// Copyright (C) 2019-2022 Nicola Murino
|
|
|
|
//
|
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU Affero General Public License as published
|
|
|
|
// by the Free Software Foundation, version 3.
|
|
|
|
//
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU Affero General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Affero General Public License
|
|
|
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
|
2021-01-17 21:29:08 +00:00
|
|
|
package httpd
|
|
|
|
|
|
|
|
import (
|
2021-02-03 07:55:28 +00:00
|
|
|
"errors"
|
|
|
|
"fmt"
|
2021-01-17 21:29:08 +00:00
|
|
|
"net/http"
|
|
|
|
"time"
|
|
|
|
|
2021-03-05 17:50:45 +00:00
|
|
|
"github.com/go-chi/jwtauth/v5"
|
2022-11-19 12:07:03 +00:00
|
|
|
"github.com/lestrrat-go/jwx/v2/jwt"
|
2021-01-17 21:29:08 +00:00
|
|
|
"github.com/rs/xid"
|
|
|
|
|
2022-07-24 14:18:54 +00:00
|
|
|
"github.com/drakkan/sftpgo/v2/internal/dataprovider"
|
|
|
|
"github.com/drakkan/sftpgo/v2/internal/logger"
|
|
|
|
"github.com/drakkan/sftpgo/v2/internal/util"
|
2021-01-17 21:29:08 +00:00
|
|
|
)
|
|
|
|
|
2021-02-02 08:14:10 +00:00
|
|
|
type tokenAudience = string
|
|
|
|
|
|
|
|
const (
|
2021-09-04 10:11:04 +00:00
|
|
|
tokenAudienceWebAdmin tokenAudience = "WebAdmin"
|
|
|
|
tokenAudienceWebClient tokenAudience = "WebClient"
|
|
|
|
tokenAudienceWebAdminPartial tokenAudience = "WebAdminPartial"
|
|
|
|
tokenAudienceWebClientPartial tokenAudience = "WebClientPartial"
|
|
|
|
tokenAudienceAPI tokenAudience = "API"
|
|
|
|
tokenAudienceAPIUser tokenAudience = "APIUser"
|
|
|
|
tokenAudienceCSRF tokenAudience = "CSRF"
|
2021-02-02 08:14:10 +00:00
|
|
|
)
|
|
|
|
|
2022-05-28 11:28:50 +00:00
|
|
|
type tokenValidation = int
|
|
|
|
|
|
|
|
const (
|
|
|
|
tokenValidationFull = iota
|
|
|
|
tokenValidationNoIPMatch tokenValidation = iota
|
|
|
|
)
|
|
|
|
|
2021-01-17 21:29:08 +00:00
|
|
|
const (
|
2022-03-06 15:57:13 +00:00
|
|
|
claimUsernameKey = "username"
|
|
|
|
claimPermissionsKey = "permissions"
|
|
|
|
claimAPIKey = "api_key"
|
2022-09-25 17:48:55 +00:00
|
|
|
claimNodeID = "node_id"
|
2022-03-06 15:57:13 +00:00
|
|
|
claimMustSetSecondFactorKey = "2fa_required"
|
2022-09-21 17:36:08 +00:00
|
|
|
claimRequiredTwoFactorProtocols = "2fa_protos"
|
|
|
|
claimHideUserPageSection = "hus"
|
2022-03-06 15:57:13 +00:00
|
|
|
basicRealm = "Basic realm=\"SFTPGo\""
|
|
|
|
jwtCookieKey = "jwt"
|
2021-01-17 21:29:08 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
2021-07-01 18:17:40 +00:00
|
|
|
tokenDuration = 20 * time.Minute
|
|
|
|
// csrf token duration is greater than normal token duration to reduce issues
|
|
|
|
// with the login form
|
2021-11-06 13:13:20 +00:00
|
|
|
csrfTokenDuration = 6 * time.Hour
|
|
|
|
tokenRefreshThreshold = 10 * time.Minute
|
2022-05-28 11:28:50 +00:00
|
|
|
tokenValidationMode = tokenValidationFull
|
2021-01-17 21:29:08 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type jwtTokenClaims struct {
|
2022-03-06 15:57:13 +00:00
|
|
|
Username string
|
|
|
|
Permissions []string
|
|
|
|
Signature string
|
2022-03-26 07:41:50 +00:00
|
|
|
Audience []string
|
2022-03-06 15:57:13 +00:00
|
|
|
APIKeyID string
|
2022-09-25 17:48:55 +00:00
|
|
|
NodeID string
|
2022-03-06 15:57:13 +00:00
|
|
|
MustSetTwoFactorAuth bool
|
|
|
|
RequiredTwoFactorProtocols []string
|
2022-09-21 17:36:08 +00:00
|
|
|
HideUserPageSections int
|
2021-01-17 21:29:08 +00:00
|
|
|
}
|
|
|
|
|
2021-09-04 10:11:04 +00:00
|
|
|
func (c *jwtTokenClaims) hasUserAudience() bool {
|
2022-03-26 07:41:50 +00:00
|
|
|
for _, audience := range c.Audience {
|
|
|
|
if audience == tokenAudienceWebClient || audience == tokenAudienceAPIUser {
|
|
|
|
return true
|
|
|
|
}
|
2021-09-04 10:11:04 +00:00
|
|
|
}
|
2022-03-26 07:41:50 +00:00
|
|
|
|
2021-09-04 10:11:04 +00:00
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
2022-05-19 17:49:51 +00:00
|
|
|
func (c *jwtTokenClaims) asMap() map[string]any {
|
|
|
|
claims := make(map[string]any)
|
2021-01-17 21:29:08 +00:00
|
|
|
|
|
|
|
claims[claimUsernameKey] = c.Username
|
|
|
|
claims[claimPermissionsKey] = c.Permissions
|
2021-08-17 16:08:32 +00:00
|
|
|
if c.APIKeyID != "" {
|
|
|
|
claims[claimAPIKey] = c.APIKeyID
|
|
|
|
}
|
2022-09-25 17:48:55 +00:00
|
|
|
if c.NodeID != "" {
|
|
|
|
claims[claimNodeID] = c.NodeID
|
|
|
|
}
|
2021-01-17 21:29:08 +00:00
|
|
|
claims[jwt.SubjectKey] = c.Signature
|
2022-09-21 17:36:08 +00:00
|
|
|
if c.MustSetTwoFactorAuth {
|
|
|
|
claims[claimMustSetSecondFactorKey] = c.MustSetTwoFactorAuth
|
|
|
|
}
|
|
|
|
if len(c.RequiredTwoFactorProtocols) > 0 {
|
|
|
|
claims[claimRequiredTwoFactorProtocols] = c.RequiredTwoFactorProtocols
|
|
|
|
}
|
|
|
|
if c.HideUserPageSections > 0 {
|
|
|
|
claims[claimHideUserPageSection] = c.HideUserPageSections
|
|
|
|
}
|
2021-01-17 21:29:08 +00:00
|
|
|
|
|
|
|
return claims
|
|
|
|
}
|
|
|
|
|
2022-09-21 17:36:08 +00:00
|
|
|
func (c *jwtTokenClaims) decodeSliceString(val any) []string {
|
|
|
|
var result []string
|
|
|
|
|
|
|
|
switch v := val.(type) {
|
|
|
|
case []any:
|
|
|
|
for _, elem := range v {
|
|
|
|
switch elemValue := elem.(type) {
|
|
|
|
case string:
|
|
|
|
result = append(result, elemValue)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return result
|
|
|
|
}
|
|
|
|
|
2022-05-19 17:49:51 +00:00
|
|
|
func (c *jwtTokenClaims) Decode(token map[string]any) {
|
2021-09-18 08:50:17 +00:00
|
|
|
c.Permissions = nil
|
2021-01-17 21:29:08 +00:00
|
|
|
username := token[claimUsernameKey]
|
|
|
|
|
|
|
|
switch v := username.(type) {
|
|
|
|
case string:
|
|
|
|
c.Username = v
|
|
|
|
}
|
|
|
|
|
|
|
|
signature := token[jwt.SubjectKey]
|
|
|
|
|
|
|
|
switch v := signature.(type) {
|
|
|
|
case string:
|
|
|
|
c.Signature = v
|
|
|
|
}
|
|
|
|
|
2021-09-04 10:11:04 +00:00
|
|
|
audience := token[jwt.AudienceKey]
|
|
|
|
|
|
|
|
switch v := audience.(type) {
|
|
|
|
case []string:
|
2022-03-26 07:41:50 +00:00
|
|
|
c.Audience = v
|
2021-09-04 10:11:04 +00:00
|
|
|
}
|
|
|
|
|
2021-08-17 16:08:32 +00:00
|
|
|
if val, ok := token[claimAPIKey]; ok {
|
|
|
|
switch v := val.(type) {
|
|
|
|
case string:
|
|
|
|
c.APIKeyID = v
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-09-25 17:48:55 +00:00
|
|
|
if val, ok := token[claimNodeID]; ok {
|
|
|
|
switch v := val.(type) {
|
|
|
|
case string:
|
|
|
|
c.NodeID = v
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-01-17 21:29:08 +00:00
|
|
|
permissions := token[claimPermissionsKey]
|
2022-09-21 17:36:08 +00:00
|
|
|
c.Permissions = c.decodeSliceString(permissions)
|
|
|
|
|
|
|
|
if val, ok := token[claimMustSetSecondFactorKey]; ok {
|
|
|
|
switch v := val.(type) {
|
|
|
|
case bool:
|
|
|
|
c.MustSetTwoFactorAuth = v
|
2021-01-17 21:29:08 +00:00
|
|
|
}
|
|
|
|
}
|
2022-03-06 15:57:13 +00:00
|
|
|
|
2022-09-21 17:36:08 +00:00
|
|
|
if val, ok := token[claimRequiredTwoFactorProtocols]; ok {
|
|
|
|
c.RequiredTwoFactorProtocols = c.decodeSliceString(val)
|
2022-03-06 15:57:13 +00:00
|
|
|
}
|
|
|
|
|
2022-09-21 17:36:08 +00:00
|
|
|
if val, ok := token[claimHideUserPageSection]; ok {
|
|
|
|
switch v := val.(type) {
|
|
|
|
case float64:
|
|
|
|
c.HideUserPageSections = int(v)
|
2022-03-06 15:57:13 +00:00
|
|
|
}
|
|
|
|
}
|
2021-01-17 21:29:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (c *jwtTokenClaims) isCriticalPermRemoved(permissions []string) bool {
|
2022-05-19 17:49:51 +00:00
|
|
|
if util.Contains(permissions, dataprovider.PermAdminAny) {
|
2021-01-17 21:29:08 +00:00
|
|
|
return false
|
|
|
|
}
|
2022-05-19 17:49:51 +00:00
|
|
|
if (util.Contains(c.Permissions, dataprovider.PermAdminManageAdmins) ||
|
|
|
|
util.Contains(c.Permissions, dataprovider.PermAdminAny)) &&
|
|
|
|
!util.Contains(permissions, dataprovider.PermAdminManageAdmins) &&
|
|
|
|
!util.Contains(permissions, dataprovider.PermAdminAny) {
|
2021-01-17 21:29:08 +00:00
|
|
|
return true
|
|
|
|
}
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c *jwtTokenClaims) hasPerm(perm string) bool {
|
2022-05-19 17:49:51 +00:00
|
|
|
if util.Contains(c.Permissions, dataprovider.PermAdminAny) {
|
2021-01-17 21:29:08 +00:00
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
2022-05-19 17:49:51 +00:00
|
|
|
return util.Contains(c.Permissions, perm)
|
2021-01-17 21:29:08 +00:00
|
|
|
}
|
|
|
|
|
2022-03-24 21:03:17 +00:00
|
|
|
func (c *jwtTokenClaims) createToken(tokenAuth *jwtauth.JWTAuth, audience tokenAudience, ip string) (jwt.Token, string, error) {
|
2021-01-17 21:29:08 +00:00
|
|
|
claims := c.asMap()
|
|
|
|
now := time.Now().UTC()
|
|
|
|
|
2022-03-26 07:41:50 +00:00
|
|
|
claims[jwt.JwtIDKey] = xid.New().String()
|
2021-01-17 21:29:08 +00:00
|
|
|
claims[jwt.NotBeforeKey] = now.Add(-30 * time.Second)
|
|
|
|
claims[jwt.ExpirationKey] = now.Add(tokenDuration)
|
2022-03-26 07:41:50 +00:00
|
|
|
claims[jwt.AudienceKey] = []string{audience, ip}
|
2021-01-17 21:29:08 +00:00
|
|
|
|
2022-02-13 13:30:20 +00:00
|
|
|
return tokenAuth.Encode(claims)
|
|
|
|
}
|
|
|
|
|
2022-05-19 17:49:51 +00:00
|
|
|
func (c *jwtTokenClaims) createTokenResponse(tokenAuth *jwtauth.JWTAuth, audience tokenAudience, ip string) (map[string]any, error) {
|
2022-03-24 21:03:17 +00:00
|
|
|
token, tokenString, err := c.createToken(tokenAuth, audience, ip)
|
2021-01-17 21:29:08 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
2022-05-19 17:49:51 +00:00
|
|
|
response := make(map[string]any)
|
2021-01-17 21:29:08 +00:00
|
|
|
response["access_token"] = tokenString
|
|
|
|
response["expires_at"] = token.Expiration().Format(time.RFC3339)
|
|
|
|
|
|
|
|
return response, nil
|
|
|
|
}
|
|
|
|
|
2022-03-24 21:03:17 +00:00
|
|
|
func (c *jwtTokenClaims) createAndSetCookie(w http.ResponseWriter, r *http.Request, tokenAuth *jwtauth.JWTAuth,
|
|
|
|
audience tokenAudience, ip string,
|
|
|
|
) error {
|
|
|
|
resp, err := c.createTokenResponse(tokenAuth, audience, ip)
|
2021-01-17 21:29:08 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2021-05-06 19:35:43 +00:00
|
|
|
var basePath string
|
2021-09-04 10:11:04 +00:00
|
|
|
if audience == tokenAudienceWebAdmin || audience == tokenAudienceWebAdminPartial {
|
2021-05-06 19:35:43 +00:00
|
|
|
basePath = webBaseAdminPath
|
|
|
|
} else {
|
|
|
|
basePath = webBaseClientPath
|
|
|
|
}
|
2021-01-17 21:29:08 +00:00
|
|
|
http.SetCookie(w, &http.Cookie{
|
2022-02-13 13:30:20 +00:00
|
|
|
Name: jwtCookieKey,
|
2021-01-17 21:29:08 +00:00
|
|
|
Value: resp["access_token"].(string),
|
2021-05-06 19:35:43 +00:00
|
|
|
Path: basePath,
|
2021-01-17 21:29:08 +00:00
|
|
|
Expires: time.Now().Add(tokenDuration),
|
2021-05-16 07:13:00 +00:00
|
|
|
MaxAge: int(tokenDuration / time.Second),
|
2021-01-17 21:29:08 +00:00
|
|
|
HttpOnly: true,
|
2021-05-11 04:54:06 +00:00
|
|
|
Secure: isTLS(r),
|
2021-05-16 07:13:00 +00:00
|
|
|
SameSite: http.SameSiteStrictMode,
|
2021-01-17 21:29:08 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2021-05-16 07:13:00 +00:00
|
|
|
func (c *jwtTokenClaims) removeCookie(w http.ResponseWriter, r *http.Request, cookiePath string) {
|
2021-01-17 21:29:08 +00:00
|
|
|
http.SetCookie(w, &http.Cookie{
|
2022-02-13 13:30:20 +00:00
|
|
|
Name: jwtCookieKey,
|
2021-01-17 21:29:08 +00:00
|
|
|
Value: "",
|
2021-05-16 07:13:00 +00:00
|
|
|
Path: cookiePath,
|
|
|
|
Expires: time.Unix(0, 0),
|
2021-01-17 21:29:08 +00:00
|
|
|
MaxAge: -1,
|
|
|
|
HttpOnly: true,
|
2021-05-11 04:54:06 +00:00
|
|
|
Secure: isTLS(r),
|
2021-05-16 07:13:00 +00:00
|
|
|
SameSite: http.SameSiteStrictMode,
|
2021-01-17 21:29:08 +00:00
|
|
|
})
|
2021-01-26 21:35:36 +00:00
|
|
|
invalidateToken(r)
|
|
|
|
}
|
|
|
|
|
2022-02-13 13:30:20 +00:00
|
|
|
func tokenFromContext(r *http.Request) string {
|
|
|
|
if token, ok := r.Context().Value(oidcGeneratedToken).(string); ok {
|
|
|
|
return token
|
|
|
|
}
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
|
2021-05-11 04:54:06 +00:00
|
|
|
func isTLS(r *http.Request) bool {
|
|
|
|
if r.TLS != nil {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
if proto, ok := r.Context().Value(forwardedProtoKey).(string); ok {
|
|
|
|
return proto == "https"
|
|
|
|
}
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
2021-01-26 21:35:36 +00:00
|
|
|
func isTokenInvalidated(r *http.Request) bool {
|
2022-02-13 13:30:20 +00:00
|
|
|
var findTokenFns []func(r *http.Request) string
|
|
|
|
findTokenFns = append(findTokenFns, jwtauth.TokenFromHeader)
|
|
|
|
findTokenFns = append(findTokenFns, jwtauth.TokenFromCookie)
|
|
|
|
findTokenFns = append(findTokenFns, tokenFromContext)
|
|
|
|
|
2021-01-26 21:35:36 +00:00
|
|
|
isTokenFound := false
|
2022-02-13 13:30:20 +00:00
|
|
|
for _, fn := range findTokenFns {
|
|
|
|
token := fn(r)
|
|
|
|
if token != "" {
|
|
|
|
isTokenFound = true
|
|
|
|
if _, ok := invalidatedJWTTokens.Load(token); ok {
|
|
|
|
return true
|
|
|
|
}
|
2021-01-26 21:35:36 +00:00
|
|
|
}
|
|
|
|
}
|
2022-02-13 13:30:20 +00:00
|
|
|
|
2021-01-26 21:35:36 +00:00
|
|
|
return !isTokenFound
|
|
|
|
}
|
|
|
|
|
|
|
|
func invalidateToken(r *http.Request) {
|
|
|
|
tokenString := jwtauth.TokenFromHeader(r)
|
|
|
|
if tokenString != "" {
|
2021-09-04 10:11:04 +00:00
|
|
|
invalidatedJWTTokens.Store(tokenString, time.Now().Add(tokenDuration).UTC())
|
2021-01-26 21:35:36 +00:00
|
|
|
}
|
|
|
|
tokenString = jwtauth.TokenFromCookie(r)
|
|
|
|
if tokenString != "" {
|
2021-09-04 10:11:04 +00:00
|
|
|
invalidatedJWTTokens.Store(tokenString, time.Now().Add(tokenDuration).UTC())
|
2021-01-26 21:35:36 +00:00
|
|
|
}
|
2021-01-17 21:29:08 +00:00
|
|
|
}
|
|
|
|
|
2021-05-06 19:35:43 +00:00
|
|
|
func getUserFromToken(r *http.Request) *dataprovider.User {
|
|
|
|
user := &dataprovider.User{}
|
|
|
|
_, claims, err := jwtauth.FromContext(r.Context())
|
|
|
|
if err != nil {
|
|
|
|
return user
|
|
|
|
}
|
|
|
|
tokenClaims := jwtTokenClaims{}
|
|
|
|
tokenClaims.Decode(claims)
|
|
|
|
user.Username = tokenClaims.Username
|
|
|
|
user.Filters.WebClient = tokenClaims.Permissions
|
|
|
|
return user
|
|
|
|
}
|
|
|
|
|
2021-01-17 21:29:08 +00:00
|
|
|
func getAdminFromToken(r *http.Request) *dataprovider.Admin {
|
|
|
|
admin := &dataprovider.Admin{}
|
|
|
|
_, claims, err := jwtauth.FromContext(r.Context())
|
|
|
|
if err != nil {
|
|
|
|
return admin
|
|
|
|
}
|
|
|
|
tokenClaims := jwtTokenClaims{}
|
|
|
|
tokenClaims.Decode(claims)
|
|
|
|
admin.Username = tokenClaims.Username
|
|
|
|
admin.Permissions = tokenClaims.Permissions
|
2022-09-21 17:36:08 +00:00
|
|
|
admin.Filters.Preferences.HideUserPageSections = tokenClaims.HideUserPageSections
|
2021-01-17 21:29:08 +00:00
|
|
|
return admin
|
|
|
|
}
|
2021-02-03 07:55:28 +00:00
|
|
|
|
2022-03-26 07:41:50 +00:00
|
|
|
func createCSRFToken(ip string) string {
|
2022-05-19 17:49:51 +00:00
|
|
|
claims := make(map[string]any)
|
2021-02-03 07:55:28 +00:00
|
|
|
now := time.Now().UTC()
|
|
|
|
|
|
|
|
claims[jwt.JwtIDKey] = xid.New().String()
|
|
|
|
claims[jwt.NotBeforeKey] = now.Add(-30 * time.Second)
|
2021-07-01 18:17:40 +00:00
|
|
|
claims[jwt.ExpirationKey] = now.Add(csrfTokenDuration)
|
2022-03-26 07:41:50 +00:00
|
|
|
claims[jwt.AudienceKey] = []string{tokenAudienceCSRF, ip}
|
2021-02-03 07:55:28 +00:00
|
|
|
|
|
|
|
_, tokenString, err := csrfTokenAuth.Encode(claims)
|
|
|
|
if err != nil {
|
|
|
|
logger.Debug(logSender, "", "unable to create CSRF token: %v", err)
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
return tokenString
|
|
|
|
}
|
|
|
|
|
2022-03-26 07:41:50 +00:00
|
|
|
func verifyCSRFToken(tokenString, ip string) error {
|
2021-02-03 07:55:28 +00:00
|
|
|
token, err := jwtauth.VerifyToken(csrfTokenAuth, tokenString)
|
|
|
|
if err != nil || token == nil {
|
2021-05-23 20:02:01 +00:00
|
|
|
logger.Debug(logSender, "", "error validating CSRF token %#v: %v", tokenString, err)
|
2021-03-21 18:15:47 +00:00
|
|
|
return fmt.Errorf("unable to verify form token: %v", err)
|
2021-02-03 07:55:28 +00:00
|
|
|
}
|
|
|
|
|
2022-05-19 17:49:51 +00:00
|
|
|
if !util.Contains(token.Audience(), tokenAudienceCSRF) {
|
2021-02-03 07:55:28 +00:00
|
|
|
logger.Debug(logSender, "", "error validating CSRF token audience")
|
2021-03-21 18:15:47 +00:00
|
|
|
return errors.New("the form token is not valid")
|
2021-02-03 07:55:28 +00:00
|
|
|
}
|
|
|
|
|
2022-05-28 11:28:50 +00:00
|
|
|
if tokenValidationMode != tokenValidationNoIPMatch {
|
|
|
|
if !util.Contains(token.Audience(), ip) {
|
|
|
|
logger.Debug(logSender, "", "error validating CSRF token IP audience")
|
|
|
|
return errors.New("the form token is not valid")
|
|
|
|
}
|
2022-03-26 07:41:50 +00:00
|
|
|
}
|
|
|
|
|
2021-02-03 07:55:28 +00:00
|
|
|
return nil
|
|
|
|
}
|