Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
12f63d9c
V
vscode
项目概览
xxadev
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
12f63d9c
编写于
7月 28, 2020
作者:
R
Rachel Macfarlane
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Stabilize authentication consumer side, fixes #100993
上级
51cdb499
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
120 addition
and
111 deletion
+120
-111
extensions/github-authentication/src/github.ts
extensions/github-authentication/src/github.ts
+1
-1
extensions/microsoft-authentication/src/AADHelper.ts
extensions/microsoft-authentication/src/AADHelper.ts
+1
-1
src/vs/vscode.d.ts
src/vs/vscode.d.ts
+116
-0
src/vs/vscode.proposed.d.ts
src/vs/vscode.proposed.d.ts
+2
-109
未找到文件。
extensions/github-authentication/src/github.ts
浏览文件 @
12f63d9c
...
...
@@ -9,7 +9,7 @@ import { keychain } from './common/keychain';
import
{
GitHubServer
,
NETWORK_ERROR
}
from
'
./githubServer
'
;
import
Logger
from
'
./common/logger
'
;
export
const
onDidChangeSessions
=
new
vscode
.
EventEmitter
<
vscode
.
AuthenticationSessionsChangeEvent
>
();
export
const
onDidChangeSessions
=
new
vscode
.
EventEmitter
<
vscode
.
Authentication
ProviderAuthentication
SessionsChangeEvent
>
();
interface
SessionData
{
id
:
string
;
...
...
extensions/microsoft-authentication/src/AADHelper.ts
浏览文件 @
12f63d9c
...
...
@@ -73,7 +73,7 @@ function parseQuery(uri: vscode.Uri) {
},
{});
}
export
const
onDidChangeSessions
=
new
vscode
.
EventEmitter
<
vscode
.
AuthenticationSessionsChangeEvent
>
();
export
const
onDidChangeSessions
=
new
vscode
.
EventEmitter
<
vscode
.
Authentication
ProviderAuthentication
SessionsChangeEvent
>
();
export
const
REFRESH_NETWORK_FAILURE
=
'
Network failure
'
;
...
...
src/vs/vscode.d.ts
浏览文件 @
12f63d9c
...
...
@@ -11521,6 +11521,122 @@ declare module 'vscode' {
}
//#endregion
/**
* Represents a session of a currently logged in user.
*/
export
interface
AuthenticationSession
{
/**
* The identifier of the authentication session.
*/
readonly
id
:
string
;
/**
* The access token.
*/
readonly
accessToken
:
string
;
/**
* The account associated with the session.
*/
readonly
account
:
AuthenticationSessionAccountInformation
;
/**
* The permissions granted by the session's access token. Available scopes
* are defined by the [AuthenticationProvider](#AuthenticationProvider).
*/
readonly
scopes
:
ReadonlyArray
<
string
>
;
}
/**
* The information of an account associated with an [AuthenticationSession](#AuthenticationSession).
*/
export
interface
AuthenticationSessionAccountInformation
{
/**
* The unique identifier of the account.
*/
readonly
id
:
string
;
/**
* The human-readable name of the account.
*/
readonly
label
:
string
;
}
/**
* Options to be used when getting an [AuthenticationSession](#AuthenticationSession) from an [AuthenticationProvider](#AuthenticationProvider).
*/
export
interface
AuthenticationGetSessionOptions
{
/**
* Whether login should be performed if there is no matching session. Defaults to false.
*/
createIfNone
?:
boolean
;
/**
* Whether the existing user session preference should be cleared. Set to allow the user to switch accounts.
* Defaults to false.
*/
clearSessionPreference
?:
boolean
;
}
/**
* Basic information about an[authenticationProvider](#AuthenticationProvider)
*/
export
interface
AuthenticationProviderInformation
{
/**
* The unique identifier of the authentication provider.
*/
readonly
id
:
string
;
/**
* The human-readable name of the authentication provider.
*/
readonly
label
:
string
;
}
/**
* An [event](#Event) which fires when an [AuthenticationSession](#AuthenticationSession) is added, removed, or changed.
*/
export
interface
AuthenticationSessionsChangeEvent
{
/**
* The [authenticationProvider](#AuthenticationProvider) that has had its sessions change.
*/
readonly
provider
:
AuthenticationProviderInformation
;
}
export
namespace
authentication
{
/**
* Get an authentication session matching the desired scopes. Rejects if a provider with providerId is not
* registered, or if the user does not consent to sharing authentication information with
* the extension. If there are multiple sessions with the same scopes, the user will be shown a
* quickpick to select which account they would like to use.
* @param providerId The id of the provider to use
* @param scopes A list of scopes representing the permissions requested. These are dependent on the authentication provider
* @param options The [getSessionOptions](#GetSessionOptions) to use
* @returns A thenable that resolves to an authentication session
*/
export
function
getSession
(
providerId
:
string
,
scopes
:
string
[],
options
:
AuthenticationGetSessionOptions
&
{
createIfNone
:
true
}):
Thenable
<
AuthenticationSession
>
;
/**
* Get an authentication session matching the desired scopes. Rejects if a provider with providerId is not
* registered, or if the user does not consent to sharing authentication information with
* the extension. If there are multiple sessions with the same scopes, the user will be shown a
* quickpick to select which account they would like to use.
* @param providerId The id of the provider to use
* @param scopes A list of scopes representing the permissions requested. These are dependent on the authentication provider
* @param options The [getSessionOptions](#GetSessionOptions) to use
* @returns A thenable that resolves to an authentication session if available, or undefined if there are no sessions
*/
export
function
getSession
(
providerId
:
string
,
scopes
:
string
[],
options
:
AuthenticationGetSessionOptions
):
Thenable
<
AuthenticationSession
|
undefined
>
;
/**
* An [event](#Event) which fires when the array of sessions has changed, or data
* within a session has changed for a provider. Fires with the ids of the providers
* that have had session data change.
*/
export
const
onDidChangeSessions
:
Event
<
AuthenticationProviderAuthenticationSessionsChangeEvent
>
;
}
}
/**
...
...
src/vs/vscode.proposed.d.ts
浏览文件 @
12f63d9c
...
...
@@ -18,59 +18,6 @@ declare module 'vscode' {
// #region auth provider: https://github.com/microsoft/vscode/issues/88309
export
interface
AuthenticationSession
{
/**
* The identifier of the authentication session.
*/
readonly
id
:
string
;
/**
* The access token.
*/
readonly
accessToken
:
string
;
/**
* The account associated with the session.
*/
readonly
account
:
AuthenticationSessionAccountInformation
;
/**
* The permissions granted by the session's access token. Available scopes
* are defined by the authentication provider.
*/
readonly
scopes
:
ReadonlyArray
<
string
>
;
}
/**
* The information of an account associated with an authentication session.
*/
export
interface
AuthenticationSessionAccountInformation
{
/**
* The unique identifier of the account.
*/
readonly
id
:
string
;
/**
* The human-readable name of the account.
*/
readonly
label
:
string
;
}
/**
* Basic information about an[authenticationProvider](#AuthenticationProvider)
*/
export
interface
AuthenticationProviderInformation
{
/**
* The unique identifier of the authentication provider.
*/
readonly
id
:
string
;
/**
* The human-readable name of the authentication provider.
*/
readonly
label
:
string
;
}
/**
* An [event](#Event) which fires when an [AuthenticationProvider](#AuthenticationProvider) is added or removed.
*/
...
...
@@ -86,33 +33,10 @@ declare module 'vscode' {
readonly
removed
:
ReadonlyArray
<
AuthenticationProviderInformation
>
;
}
/**
* Options to be used when getting a session from an [AuthenticationProvider](#AuthenticationProvider).
*/
export
interface
AuthenticationGetSessionOptions
{
/**
* Whether login should be performed if there is no matching session. Defaults to false.
*/
createIfNone
?:
boolean
;
/**
* Whether the existing user session preference should be cleared. Set to allow the user to switch accounts.
* Defaults to false.
*/
clearSessionPreference
?:
boolean
;
}
export
interface
AuthenticationProviderAuthenticationSessionsChangeEvent
{
/**
* The [authenticationProvider](#AuthenticationProvider) that has had its sessions change.
*/
readonly
provider
:
AuthenticationProviderInformation
;
}
/**
* An [event](#Event) which fires when an [AuthenticationSession](#AuthenticationSession) is added, removed, or changed.
*/
export
interface
AuthenticationSessionsChangeEvent
{
export
interface
Authentication
ProviderAuthentication
SessionsChangeEvent
{
/**
* The ids of the [AuthenticationSession](#AuthenticationSession)s that have been added.
*/
...
...
@@ -156,7 +80,7 @@ declare module 'vscode' {
* An [event](#Event) which fires when the array of sessions has changed, or data
* within a session has changed.
*/
readonly
onDidChangeSessions
:
Event
<
AuthenticationSessionsChangeEvent
>
;
readonly
onDidChangeSessions
:
Event
<
Authentication
ProviderAuthentication
SessionsChangeEvent
>
;
/**
* Returns an array of current sessions.
...
...
@@ -210,30 +134,6 @@ declare module 'vscode' {
*/
export
const
providers
:
ReadonlyArray
<
AuthenticationProviderInformation
>
;
/**
* Get an authentication session matching the desired scopes. Rejects if a provider with providerId is not
* registered, or if the user does not consent to sharing authentication information with
* the extension. If there are multiple sessions with the same scopes, the user will be shown a
* quickpick to select which account they would like to use.
* @param providerId The id of the provider to use
* @param scopes A list of scopes representing the permissions requested. These are dependent on the authentication provider
* @param options The [getSessionOptions](#GetSessionOptions) to use
* @returns A thenable that resolves to an authentication session
*/
export
function
getSession
(
providerId
:
string
,
scopes
:
string
[],
options
:
AuthenticationGetSessionOptions
&
{
createIfNone
:
true
}):
Thenable
<
AuthenticationSession
>
;
/**
* Get an authentication session matching the desired scopes. Rejects if a provider with providerId is not
* registered, or if the user does not consent to sharing authentication information with
* the extension. If there are multiple sessions with the same scopes, the user will be shown a
* quickpick to select which account they would like to use.
* @param providerId The id of the provider to use
* @param scopes A list of scopes representing the permissions requested. These are dependent on the authentication provider
* @param options The [getSessionOptions](#GetSessionOptions) to use
* @returns A thenable that resolves to an authentication session if available, or undefined if there are no sessions
*/
export
function
getSession
(
providerId
:
string
,
scopes
:
string
[],
options
:
AuthenticationGetSessionOptions
):
Thenable
<
AuthenticationSession
|
undefined
>
;
/**
* @deprecated
* Logout of a specific session.
...
...
@@ -242,13 +142,6 @@ declare module 'vscode' {
* provider
*/
export
function
logout
(
providerId
:
string
,
sessionId
:
string
):
Thenable
<
void
>
;
/**
* An [event](#Event) which fires when the array of sessions has changed, or data
* within a session has changed for a provider. Fires with the ids of the providers
* that have had session data change.
*/
export
const
onDidChangeSessions
:
Event
<
AuthenticationProviderAuthenticationSessionsChangeEvent
>
;
}
//#endregion
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录