豆豆友情提示:这是一个非官方 GitHub 代理镜像,主要用于网络测试或访问加速。请勿在此进行登录、注册或处理任何敏感信息。进行这些操作请务必访问官方网站 github.com。 Raw 内容也通过此代理提供。
Skip to content

Commit f502be3

Browse files
committed
feat(ng-dev): automatically remove credentials generated by ng-dev auth service after use (#776)
After use, the credentials generated by the ng-dev auth service are automatically requested to be removed from any git credential helper which is currently active. PR Close #776
1 parent 51eae77 commit f502be3

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

ng-dev/auth/shared/ng-dev-token.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,14 @@ export function configureAuthorizedGitClientWithTemporaryToken() {
161161
});
162162

163163
// Close the socket whenever the command which established it is complete.
164-
registerCompletedFunction(() => socket.close());
164+
registerCompletedFunction(async () => {
165+
socket.close();
166+
167+
// After the action is done, request it to be forgotten by the local git client as it is no
168+
// longer valid.
169+
const git = await AuthenticatedGitClient.get();
170+
git.runGraceful(['credential', 'reject'], {input: `url=${git.getRepoGitUrl()}\n\n`});
171+
});
165172

166173
// When the token is provided via the websocket message, use the token to set up
167174
// the AuthenticatedGitClient. The token is valid as long as the socket remains open,

0 commit comments

Comments
 (0)