|
|
|
|
@ -265,8 +265,7 @@ type AuthRequest struct {
|
|
|
|
|
// with a backend.
|
|
|
|
|
Claims Claims `json:"claims,omitempty"` |
|
|
|
|
// The connector used to login the user. Set when the user authenticates.
|
|
|
|
|
ConnectorID string `json:"connectorID,omitempty"` |
|
|
|
|
ConnectorData []byte `json:"connectorData,omitempty"` |
|
|
|
|
ConnectorID string `json:"connectorID,omitempty"` |
|
|
|
|
|
|
|
|
|
Expiry time.Time `json:"expiry"` |
|
|
|
|
} |
|
|
|
|
@ -290,7 +289,6 @@ func toStorageAuthRequest(req AuthRequest) storage.AuthRequest {
|
|
|
|
|
ForceApprovalPrompt: req.ForceApprovalPrompt, |
|
|
|
|
LoggedIn: req.LoggedIn, |
|
|
|
|
ConnectorID: req.ConnectorID, |
|
|
|
|
ConnectorData: req.ConnectorData, |
|
|
|
|
Expiry: req.Expiry, |
|
|
|
|
Claims: toStorageClaims(req.Claims), |
|
|
|
|
} |
|
|
|
|
@ -316,7 +314,6 @@ func (cli *client) fromStorageAuthRequest(a storage.AuthRequest) AuthRequest {
|
|
|
|
|
LoggedIn: a.LoggedIn, |
|
|
|
|
ForceApprovalPrompt: a.ForceApprovalPrompt, |
|
|
|
|
ConnectorID: a.ConnectorID, |
|
|
|
|
ConnectorData: a.ConnectorData, |
|
|
|
|
Expiry: a.Expiry, |
|
|
|
|
Claims: fromStorageClaims(a.Claims), |
|
|
|
|
} |
|
|
|
|
@ -411,28 +408,26 @@ func (cli *client) fromStorageAuthCode(a storage.AuthCode) AuthCode {
|
|
|
|
|
Name: a.ID, |
|
|
|
|
Namespace: cli.namespace, |
|
|
|
|
}, |
|
|
|
|
ClientID: a.ClientID, |
|
|
|
|
RedirectURI: a.RedirectURI, |
|
|
|
|
ConnectorID: a.ConnectorID, |
|
|
|
|
ConnectorData: a.ConnectorData, |
|
|
|
|
Nonce: a.Nonce, |
|
|
|
|
Scopes: a.Scopes, |
|
|
|
|
Claims: fromStorageClaims(a.Claims), |
|
|
|
|
Expiry: a.Expiry, |
|
|
|
|
ClientID: a.ClientID, |
|
|
|
|
RedirectURI: a.RedirectURI, |
|
|
|
|
ConnectorID: a.ConnectorID, |
|
|
|
|
Nonce: a.Nonce, |
|
|
|
|
Scopes: a.Scopes, |
|
|
|
|
Claims: fromStorageClaims(a.Claims), |
|
|
|
|
Expiry: a.Expiry, |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func toStorageAuthCode(a AuthCode) storage.AuthCode { |
|
|
|
|
return storage.AuthCode{ |
|
|
|
|
ID: a.ObjectMeta.Name, |
|
|
|
|
ClientID: a.ClientID, |
|
|
|
|
RedirectURI: a.RedirectURI, |
|
|
|
|
ConnectorID: a.ConnectorID, |
|
|
|
|
ConnectorData: a.ConnectorData, |
|
|
|
|
Nonce: a.Nonce, |
|
|
|
|
Scopes: a.Scopes, |
|
|
|
|
Claims: toStorageClaims(a.Claims), |
|
|
|
|
Expiry: a.Expiry, |
|
|
|
|
ID: a.ObjectMeta.Name, |
|
|
|
|
ClientID: a.ClientID, |
|
|
|
|
RedirectURI: a.RedirectURI, |
|
|
|
|
ConnectorID: a.ConnectorID, |
|
|
|
|
Nonce: a.Nonce, |
|
|
|
|
Scopes: a.Scopes, |
|
|
|
|
Claims: toStorageClaims(a.Claims), |
|
|
|
|
Expiry: a.Expiry, |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -466,16 +461,15 @@ type RefreshList struct {
|
|
|
|
|
|
|
|
|
|
func toStorageRefreshToken(r RefreshToken) storage.RefreshToken { |
|
|
|
|
return storage.RefreshToken{ |
|
|
|
|
ID: r.ObjectMeta.Name, |
|
|
|
|
Token: r.Token, |
|
|
|
|
CreatedAt: r.CreatedAt, |
|
|
|
|
LastUsed: r.LastUsed, |
|
|
|
|
ClientID: r.ClientID, |
|
|
|
|
ConnectorID: r.ConnectorID, |
|
|
|
|
ConnectorData: r.ConnectorData, |
|
|
|
|
Scopes: r.Scopes, |
|
|
|
|
Nonce: r.Nonce, |
|
|
|
|
Claims: toStorageClaims(r.Claims), |
|
|
|
|
ID: r.ObjectMeta.Name, |
|
|
|
|
Token: r.Token, |
|
|
|
|
CreatedAt: r.CreatedAt, |
|
|
|
|
LastUsed: r.LastUsed, |
|
|
|
|
ClientID: r.ClientID, |
|
|
|
|
ConnectorID: r.ConnectorID, |
|
|
|
|
Scopes: r.Scopes, |
|
|
|
|
Nonce: r.Nonce, |
|
|
|
|
Claims: toStorageClaims(r.Claims), |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -489,15 +483,14 @@ func (cli *client) fromStorageRefreshToken(r storage.RefreshToken) RefreshToken
|
|
|
|
|
Name: r.ID, |
|
|
|
|
Namespace: cli.namespace, |
|
|
|
|
}, |
|
|
|
|
Token: r.Token, |
|
|
|
|
CreatedAt: r.CreatedAt, |
|
|
|
|
LastUsed: r.LastUsed, |
|
|
|
|
ClientID: r.ClientID, |
|
|
|
|
ConnectorID: r.ConnectorID, |
|
|
|
|
ConnectorData: r.ConnectorData, |
|
|
|
|
Scopes: r.Scopes, |
|
|
|
|
Nonce: r.Nonce, |
|
|
|
|
Claims: fromStorageClaims(r.Claims), |
|
|
|
|
Token: r.Token, |
|
|
|
|
CreatedAt: r.CreatedAt, |
|
|
|
|
LastUsed: r.LastUsed, |
|
|
|
|
ClientID: r.ClientID, |
|
|
|
|
ConnectorID: r.ConnectorID, |
|
|
|
|
Scopes: r.Scopes, |
|
|
|
|
Nonce: r.Nonce, |
|
|
|
|
Claims: fromStorageClaims(r.Claims), |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -552,9 +545,10 @@ type OfflineSessions struct {
|
|
|
|
|
k8sapi.TypeMeta `json:",inline"` |
|
|
|
|
k8sapi.ObjectMeta `json:"metadata,omitempty"` |
|
|
|
|
|
|
|
|
|
UserID string `json:"userID,omitempty"` |
|
|
|
|
ConnID string `json:"connID,omitempty"` |
|
|
|
|
Refresh map[string]*storage.RefreshTokenRef `json:"refresh,omitempty"` |
|
|
|
|
UserID string `json:"userID,omitempty"` |
|
|
|
|
ConnID string `json:"connID,omitempty"` |
|
|
|
|
Refresh map[string]*storage.RefreshTokenRef `json:"refresh,omitempty"` |
|
|
|
|
ConnectorData []byte `json:"connectorData,omitempty"` |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (cli *client) fromStorageOfflineSessions(o storage.OfflineSessions) OfflineSessions { |
|
|
|
|
@ -567,17 +561,19 @@ func (cli *client) fromStorageOfflineSessions(o storage.OfflineSessions) Offline
|
|
|
|
|
Name: cli.offlineTokenName(o.UserID, o.ConnID), |
|
|
|
|
Namespace: cli.namespace, |
|
|
|
|
}, |
|
|
|
|
UserID: o.UserID, |
|
|
|
|
ConnID: o.ConnID, |
|
|
|
|
Refresh: o.Refresh, |
|
|
|
|
UserID: o.UserID, |
|
|
|
|
ConnID: o.ConnID, |
|
|
|
|
Refresh: o.Refresh, |
|
|
|
|
ConnectorData: o.ConnectorData, |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func toStorageOfflineSessions(o OfflineSessions) storage.OfflineSessions { |
|
|
|
|
s := storage.OfflineSessions{ |
|
|
|
|
UserID: o.UserID, |
|
|
|
|
ConnID: o.ConnID, |
|
|
|
|
Refresh: o.Refresh, |
|
|
|
|
UserID: o.UserID, |
|
|
|
|
ConnID: o.ConnID, |
|
|
|
|
Refresh: o.Refresh, |
|
|
|
|
ConnectorData: o.ConnectorData, |
|
|
|
|
} |
|
|
|
|
if s.Refresh == nil { |
|
|
|
|
// Server code assumes this will be non-nil.
|
|
|
|
|
|