Skip to content

Commit

Permalink
feat(ng-dev): automatically remove credentials generated by ng-dev au…
Browse files Browse the repository at this point in the history
…th 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
  • Loading branch information
josephperrott committed Aug 17, 2022
1 parent 51eae77 commit f502be3
Showing 1 changed file with 8 additions and 1 deletion.
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

0 comments on commit f502be3

Please sign in to comment.