From 2c03693972a6d1ed656920100d91e8c0f2de1215 Mon Sep 17 00:00:00 2001 From: rithu john Date: Mon, 9 Jan 2017 15:01:29 -0800 Subject: [PATCH] storage: Add ConnectorData to storage RefreshToken. --- storage/conformance/conformance.go | 1 + storage/kubernetes/storage.go | 24 +++++++++++++----------- storage/kubernetes/types.go | 5 +++-- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/storage/conformance/conformance.go b/storage/conformance/conformance.go index 490ce1d9..8cb911aa 100644 --- a/storage/conformance/conformance.go +++ b/storage/conformance/conformance.go @@ -219,6 +219,7 @@ func testRefreshTokenCRUD(t *testing.T, s storage.Storage) { EmailVerified: true, Groups: []string{"a", "b"}, }, + ConnectorData: []byte(`{"some":"data"}`), } if err := s.CreateRefresh(refresh); err != nil { t.Fatalf("create refresh token: %v", err) diff --git a/storage/kubernetes/storage.go b/storage/kubernetes/storage.go index b6d482ba..e744ab2d 100644 --- a/storage/kubernetes/storage.go +++ b/storage/kubernetes/storage.go @@ -162,11 +162,12 @@ func (cli *client) CreateRefresh(r storage.RefreshToken) error { Name: r.RefreshToken, Namespace: cli.namespace, }, - ClientID: r.ClientID, - ConnectorID: r.ConnectorID, - Scopes: r.Scopes, - Nonce: r.Nonce, - Claims: fromStorageClaims(r.Claims), + ClientID: r.ClientID, + ConnectorID: r.ConnectorID, + Scopes: r.Scopes, + Nonce: r.Nonce, + Claims: fromStorageClaims(r.Claims), + ConnectorData: r.ConnectorData, } return cli.post(resourceRefreshToken, refresh) } @@ -243,12 +244,13 @@ func (cli *client) GetRefresh(id string) (storage.RefreshToken, error) { return storage.RefreshToken{}, err } return storage.RefreshToken{ - RefreshToken: r.ObjectMeta.Name, - ClientID: r.ClientID, - ConnectorID: r.ConnectorID, - Scopes: r.Scopes, - Nonce: r.Nonce, - Claims: toStorageClaims(r.Claims), + RefreshToken: r.ObjectMeta.Name, + ClientID: r.ClientID, + ConnectorID: r.ConnectorID, + Scopes: r.Scopes, + Nonce: r.Nonce, + Claims: toStorageClaims(r.Claims), + ConnectorData: r.ConnectorData, }, nil } diff --git a/storage/kubernetes/types.go b/storage/kubernetes/types.go index 61c2c295..9009c800 100644 --- a/storage/kubernetes/types.go +++ b/storage/kubernetes/types.go @@ -367,8 +367,9 @@ type RefreshToken struct { Nonce string `json:"nonce,omitempty"` - Claims Claims `json:"claims,omitempty"` - ConnectorID string `json:"connectorID,omitempty"` + Claims Claims `json:"claims,omitempty"` + ConnectorID string `json:"connectorID,omitempty"` + ConnectorData []byte `json:"connectorData,omitempty"` } // RefreshList is a list of refresh tokens.