Fix ETCD storage backend

This commit is contained in:
Joel Speed 2018-01-29 21:11:59 +00:00
parent c789c5808e
commit c54f1656c7
No known key found for this signature in database
GPG Key ID: 6E80578D6751DEFB

View File

@ -17,7 +17,6 @@ type AuthCode struct {
Scopes []string `json:"scopes,omitempty"` Scopes []string `json:"scopes,omitempty"`
ConnectorID string `json:"connectorID,omitempty"` ConnectorID string `json:"connectorID,omitempty"`
ConnectorData []byte `json:"connectorData,omitempty"`
Claims Claims `json:"claims,omitempty"` Claims Claims `json:"claims,omitempty"`
Expiry time.Time `json:"expiry"` Expiry time.Time `json:"expiry"`
@ -29,7 +28,6 @@ func fromStorageAuthCode(a storage.AuthCode) AuthCode {
ClientID: a.ClientID, ClientID: a.ClientID,
RedirectURI: a.RedirectURI, RedirectURI: a.RedirectURI,
ConnectorID: a.ConnectorID, ConnectorID: a.ConnectorID,
ConnectorData: a.ConnectorData,
Nonce: a.Nonce, Nonce: a.Nonce,
Scopes: a.Scopes, Scopes: a.Scopes,
Claims: fromStorageClaims(a.Claims), Claims: fromStorageClaims(a.Claims),
@ -74,7 +72,6 @@ func fromStorageAuthRequest(a storage.AuthRequest) AuthRequest {
LoggedIn: a.LoggedIn, LoggedIn: a.LoggedIn,
Claims: fromStorageClaims(a.Claims), Claims: fromStorageClaims(a.Claims),
ConnectorID: a.ConnectorID, ConnectorID: a.ConnectorID,
ConnectorData: a.ConnectorData,
} }
} }
@ -90,7 +87,6 @@ func toStorageAuthRequest(a AuthRequest) storage.AuthRequest {
ForceApprovalPrompt: a.ForceApprovalPrompt, ForceApprovalPrompt: a.ForceApprovalPrompt,
LoggedIn: a.LoggedIn, LoggedIn: a.LoggedIn,
ConnectorID: a.ConnectorID, ConnectorID: a.ConnectorID,
ConnectorData: a.ConnectorData,
Expiry: a.Expiry, Expiry: a.Expiry,
Claims: toStorageClaims(a.Claims), Claims: toStorageClaims(a.Claims),
} }
@ -124,7 +120,6 @@ func toStorageRefreshToken(r RefreshToken) storage.RefreshToken {
LastUsed: r.LastUsed, LastUsed: r.LastUsed,
ClientID: r.ClientID, ClientID: r.ClientID,
ConnectorID: r.ConnectorID, ConnectorID: r.ConnectorID,
ConnectorData: r.ConnectorData,
Scopes: r.Scopes, Scopes: r.Scopes,
Nonce: r.Nonce, Nonce: r.Nonce,
Claims: toStorageClaims(r.Claims), Claims: toStorageClaims(r.Claims),
@ -139,7 +134,6 @@ func fromStorageRefreshToken(r storage.RefreshToken) RefreshToken {
LastUsed: r.LastUsed, LastUsed: r.LastUsed,
ClientID: r.ClientID, ClientID: r.ClientID,
ConnectorID: r.ConnectorID, ConnectorID: r.ConnectorID,
ConnectorData: r.ConnectorData,
Scopes: r.Scopes, Scopes: r.Scopes,
Nonce: r.Nonce, Nonce: r.Nonce,
Claims: fromStorageClaims(r.Claims), Claims: fromStorageClaims(r.Claims),
@ -191,6 +185,7 @@ type OfflineSessions struct {
UserID string `json:"user_id,omitempty"` UserID string `json:"user_id,omitempty"`
ConnID string `json:"conn_id,omitempty"` ConnID string `json:"conn_id,omitempty"`
Refresh map[string]*storage.RefreshTokenRef `json:"refresh,omitempty"` Refresh map[string]*storage.RefreshTokenRef `json:"refresh,omitempty"`
ConnectorData []byte `json:"connectorData,omitempty"`
} }
func fromStorageOfflineSessions(o storage.OfflineSessions) OfflineSessions { func fromStorageOfflineSessions(o storage.OfflineSessions) OfflineSessions {
@ -198,6 +193,7 @@ func fromStorageOfflineSessions(o storage.OfflineSessions) OfflineSessions {
UserID: o.UserID, UserID: o.UserID,
ConnID: o.ConnID, ConnID: o.ConnID,
Refresh: o.Refresh, Refresh: o.Refresh,
ConnectorData: o.ConnectorData,
} }
} }
@ -206,6 +202,7 @@ func toStorageOfflineSessions(o OfflineSessions) storage.OfflineSessions {
UserID: o.UserID, UserID: o.UserID,
ConnID: o.ConnID, ConnID: o.ConnID,
Refresh: o.Refresh, Refresh: o.Refresh,
ConnectorData: o.ConnectorData,
} }
if s.Refresh == nil { if s.Refresh == nil {
// Server code assumes this will be non-nil. // Server code assumes this will be non-nil.