Revert "Remove connectordata from other structs"

This reverts commit 27f33516db343bd79b56a47ecef0fe514a35082d.
This commit is contained in:
Joel Speed 2019-04-18 13:52:05 +01:00
parent fea048b3e8
commit 176ba709a4
No known key found for this signature in database
GPG key ID: 6E80578D6751DEFB
3 changed files with 29 additions and 22 deletions

View file

@ -259,6 +259,7 @@ func TestRefreshToken(t *testing.T) {
EmailVerified: true, EmailVerified: true,
Groups: []string{"a", "b"}, Groups: []string{"a", "b"},
}, },
ConnectorData: []byte(`{"some":"data"}`),
} }
if err := s.CreateRefresh(r); err != nil { if err := s.CreateRefresh(r); err != nil {

View file

@ -490,6 +490,7 @@ func (s *Server) finalizeLogin(identity connector.Identity, authReq storage.Auth
updater := func(a storage.AuthRequest) (storage.AuthRequest, error) { updater := func(a storage.AuthRequest) (storage.AuthRequest, error) {
a.LoggedIn = true a.LoggedIn = true
a.Claims = claims a.Claims = claims
a.ConnectorData = identity.ConnectorData
return a, nil return a, nil
} }
if err := s.storage.UpdateAuthRequest(authReq.ID, updater); err != nil { if err := s.storage.UpdateAuthRequest(authReq.ID, updater); err != nil {
@ -629,6 +630,7 @@ func (s *Server) sendCodeResponse(w http.ResponseWriter, r *http.Request, authRe
Claims: authReq.Claims, Claims: authReq.Claims,
Expiry: s.now().Add(time.Minute * 30), Expiry: s.now().Add(time.Minute * 30),
RedirectURI: authReq.RedirectURI, RedirectURI: authReq.RedirectURI,
ConnectorData: authReq.ConnectorData,
} }
if err := s.storage.CreateAuthCode(code); err != nil { if err := s.storage.CreateAuthCode(code); err != nil {
s.logger.Errorf("Failed to create auth code: %v", err) s.logger.Errorf("Failed to create auth code: %v", err)
@ -831,6 +833,7 @@ func (s *Server) handleAuthCode(w http.ResponseWriter, r *http.Request, client s
Scopes: authCode.Scopes, Scopes: authCode.Scopes,
Claims: authCode.Claims, Claims: authCode.Claims,
Nonce: authCode.Nonce, Nonce: authCode.Nonce,
ConnectorData: authCode.ConnectorData,
CreatedAt: s.now(), CreatedAt: s.now(),
LastUsed: s.now(), LastUsed: s.now(),
} }

View file

@ -182,6 +182,7 @@ type AuthRequest struct {
// The connector used to login the user and any data the connector wishes to persists. // The connector used to login the user and any data the connector wishes to persists.
// Set when the user authenticates. // Set when the user authenticates.
ConnectorID string ConnectorID string
ConnectorData []byte
} }
// AuthCode represents a code which can be exchanged for an OAuth2 token response. // AuthCode represents a code which can be exchanged for an OAuth2 token response.
@ -213,6 +214,7 @@ type AuthCode struct {
// Authentication data provided by an upstream source. // Authentication data provided by an upstream source.
ConnectorID string ConnectorID string
ConnectorData []byte
Claims Claims Claims Claims
Expiry time.Time Expiry time.Time
@ -236,6 +238,7 @@ type RefreshToken struct {
// Authentication data provided by an upstream source. // Authentication data provided by an upstream source.
ConnectorID string ConnectorID string
ConnectorData []byte
Claims Claims Claims Claims
// Scopes present in the initial request. Refresh requests may specify a set // Scopes present in the initial request. Refresh requests may specify a set