confluentinc / confluentinc/vscode

Migrate auth-related methods from ResourceManager to CCloud auth provider

Open
#2,056 0 comments 0 reactions 1 assignee Claimed by @shouples View on GitHub
cleanup extension storage
Dominant language
TypeScript
Stars
34
Forks
17
Avg merge
1d 22h
Merged PRs (30d)
8

Description

## Problem

The `ResourceManager` class currently contains several authentication-related methods that don't align with its primary responsibility of managing resource caching and storage. These methods are more appropriately placed in the CCloud auth provider class or dedicated auth helper functions.

## Current Implementation

The following auth-related methods are currently in `ResourceManager`:

https://github.com/confluentinc/vscode/blob/5875a68d3702604f740977bd1f05285d8db4e89b/src/storage/resourceManager.ts#L634-L672

- `setAuthFlowCompleted(authCallback: AuthCallbackEvent)`
- `getAuthFlowCompleted()`
- `getAuthFlowPasswordReset()`
- `setCCloudAuthStatus(status: Status)`
- `getCCloudAuthStatus()`

## Proposed Solution

Move these methods to a more appropriate location:

1. **Option 1**: Migrate to the existing CCloud auth provider class
2. **Option 2**: Create dedicated auth helper functions/utilities

The methods should maintain their current functionality but be logically grouped with other authentication-related code.

## Benefits

- **Single Responsibility**: `ResourceManager` can focus solely on resource caching and management
- **Better Organization**: Auth-related functionality is co-located with other auth code
- **Improved Maintainability**: Easier to find and modify auth-related storage logic
- **Cleaner Architecture**: More logical separation of concerns

## Acceptance Criteria

- [ ] Auth methods are moved from `ResourceManager` to appropriate auth-related class/module
- [ ] All existing functionality is preserved
- [ ] All callers of these methods are updated to use the new location
- [ ] Unit tests are updated to reflect the new structure

## Implementation Notes

- Ensure proper handling of VS Code's `SecretStorage` API
- Maintain existing error handling patterns
- Consider any dependencies on the current `ResourceManager` mutex/locking mechanisms
- Update imports across the codebase as needed

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.