Remove connectordata from other structs
This commit is contained in:
parent
0352258093
commit
5c88713177
@ -259,7 +259,6 @@ 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 {
|
||||||
|
@ -490,7 +490,6 @@ 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 {
|
||||||
@ -620,15 +619,14 @@ func (s *Server) sendCodeResponse(w http.ResponseWriter, r *http.Request, authRe
|
|||||||
switch responseType {
|
switch responseType {
|
||||||
case responseTypeCode:
|
case responseTypeCode:
|
||||||
code = storage.AuthCode{
|
code = storage.AuthCode{
|
||||||
ID: storage.NewID(),
|
ID: storage.NewID(),
|
||||||
ClientID: authReq.ClientID,
|
ClientID: authReq.ClientID,
|
||||||
ConnectorID: authReq.ConnectorID,
|
ConnectorID: authReq.ConnectorID,
|
||||||
Nonce: authReq.Nonce,
|
Nonce: authReq.Nonce,
|
||||||
Scopes: authReq.Scopes,
|
Scopes: authReq.Scopes,
|
||||||
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)
|
||||||
@ -824,16 +822,15 @@ func (s *Server) handleAuthCode(w http.ResponseWriter, r *http.Request, client s
|
|||||||
var refreshToken string
|
var refreshToken string
|
||||||
if reqRefresh {
|
if reqRefresh {
|
||||||
refresh := storage.RefreshToken{
|
refresh := storage.RefreshToken{
|
||||||
ID: storage.NewID(),
|
ID: storage.NewID(),
|
||||||
Token: storage.NewID(),
|
Token: storage.NewID(),
|
||||||
ClientID: authCode.ClientID,
|
ClientID: authCode.ClientID,
|
||||||
ConnectorID: authCode.ConnectorID,
|
ConnectorID: authCode.ConnectorID,
|
||||||
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(),
|
|
||||||
}
|
}
|
||||||
token := &internal.RefreshToken{
|
token := &internal.RefreshToken{
|
||||||
RefreshId: refresh.ID,
|
RefreshId: refresh.ID,
|
||||||
|
@ -181,8 +181,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,9 +212,8 @@ type AuthCode struct {
|
|||||||
Scopes []string
|
Scopes []string
|
||||||
|
|
||||||
// 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
|
||||||
}
|
}
|
||||||
@ -237,9 +235,8 @@ type RefreshToken struct {
|
|||||||
ClientID string
|
ClientID string
|
||||||
|
|
||||||
// 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
|
||||||
// of scopes different from the initial request when refreshing a token,
|
// of scopes different from the initial request when refreshing a token,
|
||||||
|
Reference in New Issue
Block a user