Skip to content

Commit

Permalink
Changes for PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
nickmisasi committed Nov 14, 2024
1 parent ff2f10b commit 36f0195
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions cmd/cloud/contexts.go
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,8 @@ func newCmdContextDelete() *cobra.Command {

if len(contexts.Contexts) == 0 {
contexts.CurrentContext = ""
} else {
// Set the Current Context to the first context in the map
} else if contextName == contexts.CurrentContext {
// Deleted the current context, so set context to first one in the map
contexts.CurrentContext = reflect.ValueOf(contexts.Contexts).MapKeys()[0].String()
}

Expand Down
2 changes: 1 addition & 1 deletion internal/api/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func AuthMiddleware(next http.Handler, apiContext *Context) http.Handler {
}
}

endpoint := r.URL.Path
endpoint := r.URL.EscapedPath()
if !isAccessAllowed(cid, endpoint, apiContext.AuthConfig.RestrictedClientIDs, apiContext.AuthConfig.RestrictedClientAllowedEndpointsList) {
http.Error(w, "Access denied", http.StatusForbidden)
return
Expand Down
2 changes: 2 additions & 0 deletions internal/auth/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ func EnsureValidAuthData(ctx context.Context, auth *AuthorizationResponse, orgUR
}

auth.AccessToken = newToken.AccessToken
auth.RefreshToken = newToken.RefreshToken
auth.ExpiresAt = newToken.Expiry.Unix()

return auth, nil
}
2 changes: 0 additions & 2 deletions internal/auth/device_authorization.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ func waitForAuthorization(ctx context.Context, config *oauth2.Config, deviceCode
return token, nil
case "authorization_pending":
// Do nothing, just wait
case "access_denied":
return token, fmt.Errorf("access denied")
default:
return token, fmt.Errorf("authorization failed: %v", token.Error)
}
Expand Down

0 comments on commit 36f0195

Please sign in to comment.