fix(server): creepy @@ string split logic for auth_token

This commit is contained in:
Lakhan Samani
2022-11-13 01:22:21 +05:30
parent 9320f1cb07
commit 579899c397
12 changed files with 21 additions and 29 deletions

View File

@@ -49,18 +49,7 @@ type SessionData struct {
}
// CreateAuthToken creates a new auth token when userlogs in
func CreateAuthToken(gc *gin.Context, user models.User, roles, scope []string, loginMethod, nonce string) (*Token, error) {
code := ""
nonceSplit := strings.Split(nonce, "@@")
fingerPrint := nonce
fmt.Println("=> nonce split", nonceSplit)
if len(nonceSplit) > 1 {
code = nonceSplit[1]
// use original nonce for session token and access token
nonce = nonceSplit[0]
fingerPrint = nonce
}
func CreateAuthToken(gc *gin.Context, user models.User, roles, scope []string, loginMethod, nonce string, code string) (*Token, error) {
fmt.Println("=> original nonce:", nonce)
@@ -98,7 +87,7 @@ func CreateAuthToken(gc *gin.Context, user models.User, roles, scope []string, l
}
res := &Token{
FingerPrint: fingerPrint,
FingerPrint: nonce,
FingerPrintHash: fingerPrintHash,
AccessToken: &JWTToken{Token: accessToken, ExpiresAt: accessTokenExpiresAt},
IDToken: &JWTToken{Token: idToken, ExpiresAt: idTokenExpiresAt},