@@ -167,7 +167,7 @@ func TokenHandler() gin.HandlerFunc {
167167 return
168168 }
169169 userID = claims ["sub" ].(string )
170- loginMethod := claims ["login_method" ]
170+ claimLoginMethod := claims ["login_method" ]
171171 rolesInterface := claims ["roles" ].([]interface {})
172172 scopeInterface := claims ["scope" ].([]interface {})
173173 for _ , v := range rolesInterface {
@@ -178,9 +178,11 @@ func TokenHandler() gin.HandlerFunc {
178178 }
179179
180180 sessionKey = userID
181- if loginMethod != nil && loginMethod != "" {
182- sessionKey = loginMethod .(string ) + ":" + sessionKey
181+ if claimLoginMethod != nil && claimLoginMethod != "" {
182+ sessionKey = claimLoginMethod .(string ) + ":" + sessionKey
183+ loginMethod = claimLoginMethod .(string )
183184 }
185+
184186 // remove older refresh token and rotate it for security
185187 go memorystore .Provider .DeleteUserSession (sessionKey , claims ["nonce" ].(string ))
186188 }
@@ -213,6 +215,7 @@ func TokenHandler() gin.HandlerFunc {
213215 })
214216 return
215217 }
218+
216219 memorystore .Provider .SetUserSession (sessionKey , constants .TokenTypeSessionToken + "_" + authToken .FingerPrint , authToken .FingerPrintHash )
217220 memorystore .Provider .SetUserSession (sessionKey , constants .TokenTypeAccessToken + "_" + authToken .FingerPrint , authToken .AccessToken .Token )
218221 cookie .SetSession (gc , authToken .FingerPrintHash )
0 commit comments