Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup deprecated and out-dated authentication API #11564

Merged
merged 1 commit into from
Aug 12, 2022
Merged

Conversation

martin-fleck-at
Copy link
Contributor

What it does

  • Remove very out-dated backwards compatibility to proposed VS Code API to ensure we can have proper compatible types and no conflicts between the deprecated proposed API and the stable API
    • Get rid of provider id-based API
    • Remove deprecated 'hasSession' from API
    • Deprecate login/logout (now: createSession/removeSession) in Theia

Previously we were compatible with a very specific commit of the proposed authentication API of VS Code 1.53.2. The API was moved from its proposed state to stable with 1.54.0 to which we are fully compatible even after this commit.

For a list of how the current compatibility came to be, please see #10709 (comment)

Relates to #11556

How to test

Check out commit https://github.com/martin-fleck-at/theia/tree/issue-1156-test which adds an authentication provider based on the stable API. We have commands that showcase the log in and log out of an account. This is basically an updated version of the testing strategy here: #10709

Review checklist

Reminder for reviewers

Copy link
Contributor

@colin-grant-work colin-grant-work left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. I don't see any way we can guarantee compatibility with proposed API stages, and the entire purpose of declaring the API a proposal only is that it should not be relied upon indefinitely.

Comment on lines 256 to 257
private accounts = new Map<string, string[]>(); // Map account name to session ids
private sessions = new Map<string, string>(); // Map account id to name
private sessions = new Map<string, string>(); // Map account id to name
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe as a JSDoc so that it appears on hover for anyone working here in the future?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, great idea, I fixed it!

Comment on lines 345 to 346
.then(() => this.messageService.info('Successfully signed out.'))
.then(() => { });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.then(() => this.messageService.info('Successfully signed out.'))
.then(() => { });
.then(() => { this.messageService.info('Successfully signed out.'); })

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Much better, thanks!

$onDidChangeAuthenticationSessions(id: string, label: string): Promise<void> {
this.onDidChangeSessionsEmitter.fire({ provider: { id, label } });
async $onDidChangeAuthenticationSessions(provider: theia.AuthenticationProviderInformation): Promise<void> {
this.onDidChangeSessionsEmitter.fire({ provider });
return Promise.resolve();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be deleted if the function is declared async.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, thank you!

@colin-grant-work colin-grant-work mentioned this pull request Aug 11, 2022
1 task
- Remove very out-dated backwards compatibility to proposed VS Code API
-- Get rid of provider id-based API
-- Remove deprecated 'hasSession' from API
-- Deprecate login/logout (now: createSession/removeSession) in Theia

Previously we were compatible with a very specific commit of the
proposed authentication API of VS Code 1.53.2. The API was moved from
its proposed state to stable with 1.54.0 to which we are fully
compatible.

Relates to #11556
@martin-fleck-at
Copy link
Contributor Author

@colin-grant-work Thank you very much! I fixed the issues you mentioned and pushed an update. Should we merge this then or do you (or someone else) want to perform additional tests?

@colin-grant-work
Copy link
Contributor

@martin-fleck-at, I'm fine with merging, but if you'd like to request additional reviews, that is of course perfectly fine.

@martin-fleck-at martin-fleck-at merged commit 278ca41 into master Aug 12, 2022
@martin-fleck-at martin-fleck-at deleted the issue-1156 branch August 12, 2022 14:44
@github-actions github-actions bot added this to the 1.29.0 milestone Aug 12, 2022
@vince-fugnitto vince-fugnitto added vscode issues related to VSCode compatibility authentication issues related to authentication (ex: authentication api) labels Aug 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
authentication issues related to authentication (ex: authentication api) vscode issues related to VSCode compatibility
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants