Use old ConnectorData before session.ConnectorData

This commit is contained in:
Joel Speed 2019-04-23 10:59:36 +01:00
parent 45a40a13a3
commit 19ad7daa7f
No known key found for this signature in database
GPG Key ID: 6E80578D6751DEFB
1 changed files with 6 additions and 0 deletions

View File

@ -1003,6 +1003,9 @@ func (s *Server) handleRefreshToken(w http.ResponseWriter, r *http.Request, clie
s.logger.Errorf("failed to get offline session: %v", err)
return
}
} else if len(refresh.ConnectorData) > 0 {
// Use the old connector data if it exists, should be deleted once used
connectorData = session.ConnectorData
} else {
connectorData = session.ConnectorData
}
@ -1087,6 +1090,9 @@ func (s *Server) handleRefreshToken(w http.ResponseWriter, r *http.Request, clie
old.Claims.EmailVerified = ident.EmailVerified
old.Claims.Groups = ident.Groups
old.LastUsed = lastUsed
// ConnectorData has been moved to OfflineSession
old.ConnectorData = []byte{}
return old, nil
}