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

feat(ng-dev): automatically remove credentials generated by ng-dev auth service after use #776

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion ng-dev/auth/shared/ng-dev-token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,14 @@ export function configureAuthorizedGitClientWithTemporaryToken() {
});

// Close the socket whenever the command which established it is complete.
registerCompletedFunction(() => socket.close());
registerCompletedFunction(async () => {
socket.close();

// After the action is done, request it to be forgotten by the local git client as it is no
// longer valid.
const git = await AuthenticatedGitClient.get();
git.runGraceful(['credential', 'reject'], {input: `url=${git.getRepoGitUrl()}\n\n`});
});

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