diff --git a/console/src/app/modules/accounts-card/accounts-card.component.html b/console/src/app/modules/accounts-card/accounts-card.component.html index 24fe098331..78185455ec 100644 --- a/console/src/app/modules/accounts-card/accounts-card.component.html +++ b/console/src/app/modules/accounts-card/accounts-card.component.html @@ -34,6 +34,14 @@ 'USER.STATE.' + session.authState | translate }} + keyboard_arrow_right @@ -47,5 +55,5 @@ - + diff --git a/console/src/app/modules/accounts-card/accounts-card.component.scss b/console/src/app/modules/accounts-card/accounts-card.component.scss index c4926ca891..e6a91c2f9e 100644 --- a/console/src/app/modules/accounts-card/accounts-card.component.scss +++ b/console/src/app/modules/accounts-card/accounts-card.component.scss @@ -73,9 +73,33 @@ color: inherit; text-decoration: none; + .logout-button { + visibility: hidden; + display: flex; + font-size: 1.2rem; + height: 1.2rem; + width: 1.2rem; + align-items: center; + justify-content: center; + + .icon { + font-size: 1.2rem; + } + + &:hover { + .icon { + color: $warn-color; + } + } + } + &:hover { cursor: pointer; background-color: #00000010; + + .logout-button { + visibility: visible; + } } .small-avatar { diff --git a/console/src/app/modules/accounts-card/accounts-card.component.ts b/console/src/app/modules/accounts-card/accounts-card.component.ts index 273af86467..0072f8b163 100644 --- a/console/src/app/modules/accounts-card/accounts-card.component.ts +++ b/console/src/app/modules/accounts-card/accounts-card.component.ts @@ -16,6 +16,7 @@ import { of, ReplaySubject, shareReplay, + Subject, switchMap, timeout, TimeoutError, @@ -24,7 +25,7 @@ import { import { NewFeatureService } from 'src/app/services/new-feature.service'; import { ToastService } from 'src/app/services/toast.service'; import { SessionState as V2SessionState } from '@zitadel/proto/zitadel/user_pb'; -import { filter, withLatestFrom } from 'rxjs/operators'; +import { filter, startWith, withLatestFrom } from 'rxjs/operators'; interface V1AndV2Session { displayName: string; @@ -53,6 +54,7 @@ export class AccountsCardComponent { protected readonly UserState = UserState; private readonly labelpolicy = toSignal(this.userService.labelpolicy$, { initialValue: undefined }); protected readonly sessions$: Observable; + protected readonly refresh$ = new Subject(); constructor( protected readonly authService: AuthenticationService, @@ -62,7 +64,13 @@ export class AccountsCardComponent { private readonly featureService: NewFeatureService, private readonly toast: ToastService, ) { - this.sessions$ = this.getSessions().pipe(shareReplay({ refCount: true, bufferSize: 1 })); + this.sessions$ = this.refresh$.pipe( + startWith(true), + switchMap(() => { + return this.getSessions(); + }), + shareReplay({ refCount: true, bufferSize: 1 }), + ); } private getUseLoginV2() { @@ -164,11 +172,17 @@ export class AccountsCardComponent { this.authService.authenticate(configWithPrompt).then(); } - public logout(): void { + public logoutAll(): void { const lP = JSON.stringify(this.labelpolicy()); localStorage.setItem('labelPolicyOnSignout', lP); this.authService.signout(); this.closedCard.emit(); } + + public async logoutSession($event: MouseEvent, session: V1AndV2Session) { + $event.stopPropagation(); + this.authService.signoutSession(session.loginName); + this.refresh$.next(true); + } } diff --git a/console/src/app/modules/accounts-card/accounts-card.module.ts b/console/src/app/modules/accounts-card/accounts-card.module.ts index 057175a793..4e7bfaa5b1 100644 --- a/console/src/app/modules/accounts-card/accounts-card.module.ts +++ b/console/src/app/modules/accounts-card/accounts-card.module.ts @@ -8,10 +8,20 @@ import { TranslateModule } from '@ngx-translate/core'; import { AvatarModule } from '../avatar/avatar.module'; import { AccountsCardComponent } from './accounts-card.component'; +import { MatTooltipModule } from '@angular/material/tooltip'; @NgModule({ declarations: [AccountsCardComponent], - imports: [CommonModule, MatIconModule, MatButtonModule, MatProgressBarModule, RouterModule, AvatarModule, TranslateModule], + imports: [ + CommonModule, + MatIconModule, + MatButtonModule, + MatProgressBarModule, + RouterModule, + AvatarModule, + MatTooltipModule, + TranslateModule, + ], exports: [AccountsCardComponent], }) export class AccountsCardModule {} diff --git a/console/src/app/services/authentication.service.ts b/console/src/app/services/authentication.service.ts index 3ee3024e40..c216f0b4dd 100644 --- a/console/src/app/services/authentication.service.ts +++ b/console/src/app/services/authentication.service.ts @@ -60,8 +60,15 @@ export class AuthenticationService { } public signout(): void { - this.oauthService.logOut(); + this.oauthService.revokeTokenAndLogout(); this._authenticated = false; this._authenticationChanged.next(false); } + + public signoutSession(loginHint: string): void { + this.oauthService.logOut({ + id_token_hint: loginHint, + }); + this._authenticationChanged.next(false); + } } diff --git a/console/src/assets/i18n/bg.json b/console/src/assets/i18n/bg.json index 4bd94d5ce6..1da691c742 100644 --- a/console/src/assets/i18n/bg.json +++ b/console/src/assets/i18n/bg.json @@ -424,7 +424,8 @@ "GRANTEDPROJECT": "Предоставени проекти", "HUMANUSERS": "Потребители", "MACHINEUSERS": "Потребители на услугата", - "LOGOUT": "Излезте всички потребители", + "LOGOUT": "Изход", + "LOGOUTALL": "Излезте всички потребители", "NEWORG": "Нова организация", "IAMADMIN": "Вие сте IAM администратор. ", "SHOWORGS": "Показване на всички организации", diff --git a/console/src/assets/i18n/cs.json b/console/src/assets/i18n/cs.json index 6dd066789e..8f4857ea1c 100644 --- a/console/src/assets/i18n/cs.json +++ b/console/src/assets/i18n/cs.json @@ -424,7 +424,8 @@ "GRANTEDPROJECT": "Pověřené projekty", "HUMANUSERS": "Uživatelé", "MACHINEUSERS": "Systémoví uživatelé", - "LOGOUT": "Odhlásit všechny uživatele", + "LOGOUT": "Odhlásit se", + "LOGOUTALL": "Odhlásit všechny uživatele", "NEWORG": "Nová organizace", "IAMADMIN": "Jste administrátor IAM. Vezměte prosím na vědomí, že máte rozšířená oprávnění.", "SHOWORGS": "Zobrazit všechny organizace", diff --git a/console/src/assets/i18n/de.json b/console/src/assets/i18n/de.json index cb973006e4..db14cb54ba 100644 --- a/console/src/assets/i18n/de.json +++ b/console/src/assets/i18n/de.json @@ -424,7 +424,8 @@ "GRANTEDPROJECT": "Berechtigte Projekte", "HUMANUSERS": "Benutzer", "MACHINEUSERS": "Service-Benutzer", - "LOGOUT": "Alle Benutzer abmelden", + "LOGOUT": "Abmelden", + "LOGOUTALL": "Alle Benutzer abmelden", "NEWORG": "Neue Organisation", "IAMADMIN": "Du bist ein IAM-Administrator. Beachte, dass Du erhöhte Rechte besitzt.", "SHOWORGS": "Alle Organisationen anzeigen", diff --git a/console/src/assets/i18n/en.json b/console/src/assets/i18n/en.json index be0a3d3f17..d594f11d22 100644 --- a/console/src/assets/i18n/en.json +++ b/console/src/assets/i18n/en.json @@ -424,7 +424,8 @@ "GRANTEDPROJECT": "Granted Projects", "HUMANUSERS": "Users", "MACHINEUSERS": "Service Users", - "LOGOUT": "Logout All Users", + "LOGOUT": "Logout this account", + "LOGOUTALL": "Logout All Users", "NEWORG": "New Organization", "IAMADMIN": "You are an IAM Administrator. Note that you have extended permissions.", "SHOWORGS": "Show All Organizations", diff --git a/console/src/assets/i18n/es.json b/console/src/assets/i18n/es.json index 0fc95241af..455b3e0123 100644 --- a/console/src/assets/i18n/es.json +++ b/console/src/assets/i18n/es.json @@ -424,7 +424,8 @@ "GRANTEDPROJECT": "Proyecto concedido", "HUMANUSERS": "Usuarios", "MACHINEUSERS": "Usuarios del servicio", - "LOGOUT": "Cerrar sesión para todos los usuarios", + "LOGOUT": "Cerrar sesión", + "LOGOUTALL": "Cerrar sesión para todos los usuarios", "NEWORG": "Nueva organización", "IAMADMIN": "Eres un administrador IAM. Ten en cuenta que tienes permisos ampliados.", "SHOWORGS": "Mostrar todas las organizaciones", diff --git a/console/src/assets/i18n/fr.json b/console/src/assets/i18n/fr.json index 60a0a3e482..62719e6f50 100644 --- a/console/src/assets/i18n/fr.json +++ b/console/src/assets/i18n/fr.json @@ -424,7 +424,8 @@ "GRANTEDPROJECT": "Projets octroyés", "HUMANUSERS": "Utilisateurs", "MACHINEUSERS": "Utilisateurs de services", - "LOGOUT": "Déconnexion de tous les utilisateurs", + "LOGOUT": "Déconnexion", + "LOGOUTALL": "Déconnexion de tous les utilisateurs", "NEWORG": "Nouvelle organisation", "IAMADMIN": "Vous êtes un administrateur IAM. Notez que vous disposez de permissions étendues.", "SHOWORGS": "Afficher toutes les organisations", diff --git a/console/src/assets/i18n/hu.json b/console/src/assets/i18n/hu.json index 5724c45a51..fb4159455e 100644 --- a/console/src/assets/i18n/hu.json +++ b/console/src/assets/i18n/hu.json @@ -424,7 +424,8 @@ "GRANTEDPROJECT": "Megadott Projektek", "HUMANUSERS": "Felhasználók", "MACHINEUSERS": "Szolgáltatási Felhasználók", - "LOGOUT": "Minden Felhasználó Kijelentkezése", + "LOGOUT": "Kijelentkezés", + "LOGOUTALL": "Minden Felhasználó Kijelentkezése", "NEWORG": "Új Szervezet", "IAMADMIN": "Te egy IAM Adminisztrátor vagy. Ne felejtsd el, hogy kibővített jogosultságokkal rendelkezel.", "SHOWORGS": "Show All Organizations", diff --git a/console/src/assets/i18n/id.json b/console/src/assets/i18n/id.json index 77584e883b..6ce0dd4268 100644 --- a/console/src/assets/i18n/id.json +++ b/console/src/assets/i18n/id.json @@ -393,7 +393,8 @@ "GRANTEDPROJECT": "Proyek yang Diberikan", "HUMANUSERS": "Pengguna", "MACHINEUSERS": "Pengguna Layanan", - "LOGOUT": "Logout Semua Pengguna", + "LOGOUT": "Keluar", + "LOGOUTALL": "Logout Semua Pengguna", "NEWORG": "Organisasi Baru", "IAMADMIN": "Anda adalah Administrator IAM. Perhatikan bahwa Anda memiliki izin yang diperluas.", "SHOWORGS": "Tampilkan Semua Organisasi", diff --git a/console/src/assets/i18n/it.json b/console/src/assets/i18n/it.json index b01762b175..8a6c0c54c7 100644 --- a/console/src/assets/i18n/it.json +++ b/console/src/assets/i18n/it.json @@ -424,7 +424,8 @@ "GRANTEDPROJECT": "Progetto delegato", "HUMANUSERS": "Utenti", "MACHINEUSERS": "Utenti di servizio", - "LOGOUT": "Esci con tutti gli utenti", + "LOGOUT": "Esci", + "LOGOUTALL": "Esci con tutti gli utenti", "NEWORG": "Nuova organizzazione", "IAMADMIN": "Sei un amministratore IAM. Nota che hai autorizzazioni estese.", "SHOWORGS": "Mostra tutte le organizzazioni", diff --git a/console/src/assets/i18n/ja.json b/console/src/assets/i18n/ja.json index c0429ec816..f4765b7ec2 100644 --- a/console/src/assets/i18n/ja.json +++ b/console/src/assets/i18n/ja.json @@ -424,7 +424,8 @@ "GRANTEDPROJECT": "グラントされたプロジェクト", "HUMANUSERS": "ユーザー", "MACHINEUSERS": "サービスユーザー", - "LOGOUT": "すべてのユーザーをログアウトする", + "LOGOUT": "ログアウト", + "LOGOUTALL": "すべてのユーザーをログアウトする", "NEWORG": "新しい組織", "IAMADMIN": "あなたはIAM管理者です。広範囲の権限があることに注意してください。", "SHOWORGS": "すべての組織を表示する", diff --git a/console/src/assets/i18n/ko.json b/console/src/assets/i18n/ko.json index b791234cd5..b2d786f5de 100644 --- a/console/src/assets/i18n/ko.json +++ b/console/src/assets/i18n/ko.json @@ -424,7 +424,8 @@ "GRANTEDPROJECT": "부여된 프로젝트", "HUMANUSERS": "사용자", "MACHINEUSERS": "서비스 사용자", - "LOGOUT": "모든 사용자 로그아웃", + "LOGOUT": "로그아웃", + "LOGOUTALL": "모든 사용자 로그아웃", "NEWORG": "새 조직", "IAMADMIN": "IAM 관리자입니다. 확장된 권한이 부여되었습니다.", "SHOWORGS": "모든 조직 보기", diff --git a/console/src/assets/i18n/mk.json b/console/src/assets/i18n/mk.json index 22e0e6d3d7..eca67ccce5 100644 --- a/console/src/assets/i18n/mk.json +++ b/console/src/assets/i18n/mk.json @@ -424,7 +424,8 @@ "GRANTEDPROJECT": "Доделени проекти", "HUMANUSERS": "Корисници", "MACHINEUSERS": "Сервисни корисници", - "LOGOUT": "Одјави ги сите корисници", + "LOGOUT": "Одјава", + "LOGOUTALL": "Одјави ги сите корисници", "NEWORG": "Нова организација", "IAMADMIN": "Вие сте администратор на IAM. Имате проширени овластувања.", "SHOWORGS": "Прикажи ги сите организации", diff --git a/console/src/assets/i18n/nl.json b/console/src/assets/i18n/nl.json index 112474e770..9ca464f107 100644 --- a/console/src/assets/i18n/nl.json +++ b/console/src/assets/i18n/nl.json @@ -424,7 +424,8 @@ "GRANTEDPROJECT": "Verleende projecten", "HUMANUSERS": "Gebruikers", "MACHINEUSERS": "Servicegebruikers", - "LOGOUT": "Alle gebruikers uitloggen", + "LOGOUT": "Uitloggen", + "LOGOUTALL": "Alle gebruikers uitloggen", "NEWORG": "Nieuwe organisatie", "IAMADMIN": "U bent een IAM-beheerder. Let op: u heeft uitgebreide rechten.", "SHOWORGS": "Toon alle organisaties", diff --git a/console/src/assets/i18n/pl.json b/console/src/assets/i18n/pl.json index 3244ccb4a6..6afd44441a 100644 --- a/console/src/assets/i18n/pl.json +++ b/console/src/assets/i18n/pl.json @@ -424,7 +424,8 @@ "GRANTEDPROJECT": "Uprawnione projekty", "HUMANUSERS": "Użytkownicy", "MACHINEUSERS": "Użytkownicy usług", - "LOGOUT": "Wyloguj Wszystkich Użytkowników", + "LOGOUT": "Wyloguj się", + "LOGOUTALL": "Wyloguj Wszystkich Użytkowników", "NEWORG": "Nowa Organizacja", "IAMADMIN": "Jesteś administratorem IAM. Zauważ, że masz rozszerzone uprawnienia.", "SHOWORGS": "Pokaż wszystkie organizacje", diff --git a/console/src/assets/i18n/pt.json b/console/src/assets/i18n/pt.json index 30b0f1d4e8..2fe0c031bf 100644 --- a/console/src/assets/i18n/pt.json +++ b/console/src/assets/i18n/pt.json @@ -424,7 +424,8 @@ "GRANTEDPROJECT": "Projetos Concedidos", "HUMANUSERS": "Usuários", "MACHINEUSERS": "Usuários de Serviço", - "LOGOUT": "Encerrar Sessão de Todos os Usuários", + "LOGOUT": "Encerrar Sessão", + "LOGOUTALL": "Encerrar Sessão de Todos os Usuários", "NEWORG": "Nova Organização", "IAMADMIN": "Você é um Administrador IAM. Observe que você possui permissões estendidas.", "SHOWORGS": "Mostrar Todas as Organizações", diff --git a/console/src/assets/i18n/ro.json b/console/src/assets/i18n/ro.json index 6c73852beb..9fce61de53 100644 --- a/console/src/assets/i18n/ro.json +++ b/console/src/assets/i18n/ro.json @@ -424,7 +424,8 @@ "GRANTEDPROJECT": "Proiecte acordate", "HUMANUSERS": "Utilizatori", "MACHINEUSERS": "Utilizatori de servicii", - "LOGOUT": "Deconectați toți utilizatorii", + "LOGOUT": "Deconectați", + "LOGOUTALL": "Deconectați toți utilizatorii", "NEWORG": "Organizație nouă", "IAMADMIN": "Sunteți administrator IAM. Rețineți că aveți permisiuni extinse.", "SHOWORGS": "Afișați toate organizațiile", diff --git a/console/src/assets/i18n/ru.json b/console/src/assets/i18n/ru.json index 6e2d7df7b4..ca2f6120b6 100644 --- a/console/src/assets/i18n/ru.json +++ b/console/src/assets/i18n/ru.json @@ -424,7 +424,8 @@ "GRANTEDPROJECT": "Допуски проектов", "HUMANUSERS": "Пользователи", "MACHINEUSERS": "Служебные пользователи", - "LOGOUT": "Выйти из всех пользователей", + "LOGOUT": "Выйти", + "LOGOUTALL": "Выйти из всех пользователей", "NEWORG": "Новая организация", "IAMADMIN": "Вы являетесь администратором IAM. Обратите внимание, что вы обладаете расширенными разрешениями.", "SHOWORGS": "Показать все организации", diff --git a/console/src/assets/i18n/sv.json b/console/src/assets/i18n/sv.json index e747571f7a..3ba99b42aa 100644 --- a/console/src/assets/i18n/sv.json +++ b/console/src/assets/i18n/sv.json @@ -424,7 +424,8 @@ "GRANTEDPROJECT": "Beviljade Projekt", "HUMANUSERS": "Användare", "MACHINEUSERS": "Tjänsteanvändare", - "LOGOUT": "Logga ut alla användare", + "LOGOUT": "Logga ut", + "LOGOUTALL": "Logga ut alla användare", "NEWORG": "Ny Organisation", "IAMADMIN": "Du är en IAM-administratör. Observera att du har utökade behörigheter.", "SHOWORGS": "Visa Alla Organisationer", diff --git a/console/src/assets/i18n/zh.json b/console/src/assets/i18n/zh.json index 945e4200ef..ed83d0393c 100644 --- a/console/src/assets/i18n/zh.json +++ b/console/src/assets/i18n/zh.json @@ -424,7 +424,8 @@ "GRANTEDPROJECT": "已授予的项目", "HUMANUSERS": "用户", "MACHINEUSERS": "服务用户", - "LOGOUT": "退出所有账户", + "LOGOUT": "注销", + "LOGOUTALL": "退出所有账户", "NEWORG": "创建组织", "IAMADMIN": "您是 IAM 管理员。请注意您具有扩展权限。", "SHOWORGS": "查看所有组织",