Add oauthID to the user interface instead of session
parent
1c3b92dacb
commit
b67ea62562
|
@ -188,17 +188,9 @@ func (h *UserHandler) handleGetMe(w http.ResponseWriter, r *http.Request) {
|
|||
return
|
||||
}
|
||||
|
||||
switch s := a.(type) {
|
||||
case *influxdb.Session:
|
||||
if err := encodeResponse(ctx, w, http.StatusOK, newUserResponseFromSession(user, s)); err != nil {
|
||||
EncodeError(ctx, err, w)
|
||||
return
|
||||
}
|
||||
case *influxdb.Authorization:
|
||||
if err := encodeResponse(ctx, w, http.StatusOK, newUserResponse(user)); err != nil {
|
||||
EncodeError(ctx, err, w)
|
||||
return
|
||||
}
|
||||
if err := encodeResponse(ctx, w, http.StatusOK, newUserResponse(user)); err != nil {
|
||||
EncodeError(ctx, err, w)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -333,18 +325,6 @@ func newUserResponse(u *influxdb.User) *userResponse {
|
|||
}
|
||||
}
|
||||
|
||||
type userResponseFromSession struct {
|
||||
*userResponse
|
||||
OAuthID string `json:"oauthID,omitempty"`
|
||||
}
|
||||
|
||||
func newUserResponseFromSession(u *influxdb.User, s *influxdb.Session) *userResponseFromSession {
|
||||
return &userResponseFromSession{
|
||||
userResponse: newUserResponse(u),
|
||||
OAuthID: s.OAuthID,
|
||||
}
|
||||
}
|
||||
|
||||
// handleGetUsers is the HTTP handler for the GET /api/v2/users route.
|
||||
func (h *UserHandler) handleGetUsers(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
|
|
@ -40,7 +40,6 @@ type Session struct {
|
|||
ExpiresAt time.Time `json:"expiresAt"`
|
||||
UserID ID `json:"userID,omitempty"`
|
||||
Permissions []Permission `json:"permissions,omitempty"`
|
||||
OAuthID string `json:"oauthID,omitempty"`
|
||||
}
|
||||
|
||||
// Expired returns an error if the session is expired.
|
||||
|
|
Loading…
Reference in New Issue