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

Add handling of multiple accounts to authentication api #14149

Merged
merged 5 commits into from
Sep 12, 2024

Conversation

tsmaeder
Copy link
Contributor

@tsmaeder tsmaeder commented Sep 9, 2024

What it does

Adds "account" parameter to get/createSession() calls. This allows to handle multiple accounts with the same scopes for the same authentication provider. This may be a breaking change for users and implementers of AuthenticationService. Also removed two deprecated methods.

Fixes #14110

Contributed on behalf of STMicroelectronics

How to test

The attached extensions contributes four commands:

  1. "Log into AuthTest".
    Allows to log in with the Auth Test provider. Either into a preexisting session or with a new user name. The "default session" setting gets cleared.
  2. "Use Any Auth Test Login"
    Asks the system for a auth session while clearing the preferred session preference
  3. "Use Preferred Auth Test Login"
    Same as above, but don't clear the preferred session preference
  4. "Use Named Auth Test Login"
    Same as above, but you can select a specific user name the system will ask for

Follow-ups

Review checklist

Reminder for reviewers

Fixes eclipse-theia#14110

Contributed on behalf of STMicroelectronics

Signed-off-by: Thomas Mäder <t.s.maeder@gmail.com>
@tsmaeder
Copy link
Contributor Author

tsmaeder commented Sep 9, 2024

Here's the extensions
auth-test-0.0.1.zip
And here's the source:
auth-test-src.zip

Signed-off-by: Thomas Mäder <t.s.maeder@gmail.com>
Signed-off-by: Thomas Mäder <t.s.maeder@gmail.com>
Signed-off-by: Thomas Mäder <t.s.maeder@gmail.com>
Copy link
Contributor

@rschnekenbu rschnekenbu left a comment

Choose a reason for hiding this comment

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

LGTM!
Changelog clearly tracks breaking changes 👍

Only some minor comments on code documentation or parameters naming

@@ -104,14 +101,14 @@ export interface AuthenticationProvider {
* these permissions, otherwise all sessions should be returned.
* @returns A promise that resolves to an array of authentication sessions.
Copy link
Contributor

Choose a reason for hiding this comment

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

With the addition of the parameter, the documentation may also be updated.

@@ -104,14 +101,14 @@ export interface AuthenticationProvider {
* these permissions, otherwise all sessions should be returned.
* @returns A promise that resolves to an array of authentication sessions.
*/
getSessions(scopes?: string[]): Thenable<ReadonlyArray<AuthenticationSession>>;
getSessions(scopes: string[] | undefined, account?: AuthenticationSessionAccountInformation): Thenable<ReadonlyArray<AuthenticationSession>>;

/**
* Prompts a user to login.
* @param scopes A list of scopes, permissions, that the new session should be created with.
* @returns A promise that resolves to an authentication session.
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here

$getSessions(id: string, scopes?: string[]): Promise<ReadonlyArray<theia.AuthenticationSession>>;
$createSession(id: string, scopes: string[]): Promise<theia.AuthenticationSession>;
$getSessions(providerId: string, scopes: string[] | undefined, options: theia.AuthenticationProviderSessionOptions): Promise<ReadonlyArray<theia.AuthenticationSession>>;
$createSession(id: string, scopes: string[], options: theia.AuthenticationProviderSessionOptions): Promise<theia.AuthenticationSession>;
Copy link
Contributor

@rschnekenbu rschnekenbu Sep 12, 2024

Choose a reason for hiding this comment

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

Would it make also sense for coherence to rename parameter in create/remove session? Implementation wise, they are already naming it providerId

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If we do this, it would make sense to update the parameter name everywhere, but that's not really in the scope of this PR, IMO.

Signed-off-by: Thomas Mäder <t.s.maeder@gmail.com>
@tsmaeder tsmaeder merged commit e7e1963 into eclipse-theia:master Sep 12, 2024
11 checks passed
@sgraband sgraband added this to the 1.54.0 milestone Sep 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

[vscode] Additions to authentication namespace and session management with several accounts
3 participants