-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Conversation
Fixes eclipse-theia#14110 Contributed on behalf of STMicroelectronics Signed-off-by: Thomas Mäder <t.s.maeder@gmail.com>
Here's the extensions |
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>
There was a problem hiding this 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. |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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>; |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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>
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 ofAuthenticationService
. Also removed two deprecated methods.Fixes #14110
Contributed on behalf of STMicroelectronics
How to test
The attached extensions contributes four commands:
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.
Asks the system for a auth session while clearing the preferred session preference
Same as above, but don't clear the preferred session preference
Same as above, but you can select a specific user name the system will ask for
Follow-ups
Review checklist
Reminder for reviewers