Repository navigation
[POC] Login with Bitwarden consent and Agent Access handoff #24837
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
Draft
JaredSnider-Bitwarden
wants to merge
2
commits into
main
Choose a base branch
from
oauth
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,684
β8
Draft
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
apps/web/src/app/tools/agent-connection/agent-connections.component.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| <app-header></app-header> | ||
|
|
||
| <bit-container> | ||
| <p bitTypography="body1">{{ "loginWithBitwardenConnectionsDescription" | i18n }}</p> | ||
|
|
||
| @if (connections$ | async; as connections) { | ||
| @if (connections.length === 0) { | ||
| <p class="tw-text-muted">{{ "loginWithBitwardenNoConnections" | i18n }}</p> | ||
| } @else { | ||
| <bit-table> | ||
| <ng-container header> | ||
| <tr> | ||
| <th bitCell>{{ "name" | i18n }}</th> | ||
| <th bitCell>{{ "dateCreated" | i18n }}</th> | ||
| <th bitCell class="tw-text-right">{{ "options" | i18n }}</th> | ||
| </tr> | ||
| </ng-container> | ||
| <ng-template body> | ||
| @for (connection of connections; track connection.id) { | ||
| <tr bitRow> | ||
| <td bitCell>{{ connection.name }}</td> | ||
| <td bitCell>{{ connection.creationDate | date: "medium" }}</td> | ||
| <td bitCell class="tw-text-right"> | ||
| <button | ||
| type="button" | ||
| bitButton | ||
| buttonType="danger" | ||
| size="small" | ||
| (click)="revoke(connection)" | ||
| > | ||
| {{ "revoke" | i18n }} | ||
| </button> | ||
| </td> | ||
| </tr> | ||
| } | ||
| </ng-template> | ||
| </bit-table> | ||
| } | ||
| } | ||
| </bit-container> |
54 changes: 54 additions & 0 deletions
54
apps/web/src/app/tools/agent-connection/agent-connections.component.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| import { Component } from "@angular/core"; | ||
| import { Observable } from "rxjs"; | ||
|
|
||
| import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; | ||
| import { AgentConnectionView } from "@bitwarden/common/tools/agent-connection/models/view/agent-connection.view"; | ||
| import { AgentConnectionApiService } from "@bitwarden/common/tools/agent-connection/services/agent-connection-api.service.abstraction"; | ||
| import { InternalAgentConnectionService } from "@bitwarden/common/tools/agent-connection/services/agent-connection.service.abstraction"; | ||
| import { DialogService, ToastService } from "@bitwarden/components"; | ||
|
|
||
| import { HeaderModule } from "../../layouts/header/header.module"; | ||
| import { SharedModule } from "../../shared"; | ||
|
|
||
| /** | ||
| * Settings page listing the user's "Login with Bitwarden" agent connections with a revoke action. | ||
| * Revoking deletes the connection server-side (which pushes to the user's other clients) and from | ||
| * local state; the bot's short-lived token then expires on its own (no refresh). | ||
| */ | ||
| // FIXME(https://bitwarden.atlassian.net/browse/CL-764): Migrate to OnPush | ||
| // eslint-disable-next-line @angular-eslint/prefer-on-push-component-change-detection | ||
| @Component({ | ||
| imports: [SharedModule, HeaderModule], | ||
| templateUrl: "agent-connections.component.html", | ||
| }) | ||
| export class AgentConnectionsComponent { | ||
| protected connections$: Observable<AgentConnectionView[]> = | ||
| this.agentConnectionService.agentConnectionViews$; | ||
|
|
||
| constructor( | ||
| private agentConnectionService: InternalAgentConnectionService, | ||
| private agentConnectionApiService: AgentConnectionApiService, | ||
| private dialogService: DialogService, | ||
| private i18nService: I18nService, | ||
| private toastService: ToastService, | ||
| ) {} | ||
|
|
||
| async revoke(connection: AgentConnectionView): Promise<void> { | ||
| const confirmed = await this.dialogService.openSimpleDialog({ | ||
| title: { key: "loginWithBitwardenRevokeTitle" }, | ||
| content: { key: "loginWithBitwardenRevokeConfirm", placeholders: [connection.name] }, | ||
| type: "warning", | ||
| acceptButtonText: { key: "revoke" }, | ||
| }); | ||
| if (!confirmed) { | ||
| return; | ||
| } | ||
|
|
||
| await this.agentConnectionApiService.delete(connection.id); | ||
| await this.agentConnectionService.delete(connection.id); | ||
| this.toastService.showToast({ | ||
| variant: "success", | ||
| message: this.i18nService.t("loginWithBitwardenRevoked"), | ||
| }); | ||
| } | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
The
AgentConnectionsComponentchange-detection migration is marked FIXME; this unresolved marker leaves deferred work in production code.Details
β¨ AI Reasoning
βThe comment marks the component's change-detection migration as unfinished. A tracker link alone does not specify the remaining work or criteria for completion.
π§ How do I fix it?
Address the issues mentioned in TODO/FIXME comments, create proper issue tickets for tracking, or remove outdated comments.
Reply on this comment to give feedback or ignore the issue.
More info