mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-13 10:57:32 +00:00
feat: logout single session
This commit is contained in:
@@ -34,6 +34,14 @@
|
||||
'USER.STATE.' + session.authState | translate
|
||||
}}</span>
|
||||
</div>
|
||||
<button
|
||||
matTooltip="{{ 'MENU.LOGOUT' | translate }}"
|
||||
class="logout-button"
|
||||
mat-icon-button
|
||||
(click)="logoutSession($event, session)"
|
||||
>
|
||||
<i class="icon las la-minus-circle"></i>
|
||||
</button>
|
||||
<mat-icon>keyboard_arrow_right</mat-icon>
|
||||
</a>
|
||||
<a class="row" (click)="selectNewAccount()">
|
||||
@@ -47,5 +55,5 @@
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<button (click)="logout()" color="warn" mat-stroked-button>{{ 'MENU.LOGOUT' | translate }}</button>
|
||||
<button (click)="logoutAll()" color="warn" mat-stroked-button>{{ 'MENU.LOGOUTALL' | translate }}</button>
|
||||
</div>
|
||||
|
@@ -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 {
|
||||
|
@@ -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<V1AndV2Session[]>;
|
||||
protected readonly refresh$ = new Subject<true>();
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@@ -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 {}
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
||||
|
@@ -424,7 +424,8 @@
|
||||
"GRANTEDPROJECT": "Предоставени проекти",
|
||||
"HUMANUSERS": "Потребители",
|
||||
"MACHINEUSERS": "Потребители на услугата",
|
||||
"LOGOUT": "Излезте всички потребители",
|
||||
"LOGOUT": "Изход",
|
||||
"LOGOUTALL": "Излезте всички потребители",
|
||||
"NEWORG": "Нова организация",
|
||||
"IAMADMIN": "Вие сте IAM администратор. ",
|
||||
"SHOWORGS": "Показване на всички организации",
|
||||
|
@@ -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",
|
||||
|
@@ -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",
|
||||
|
@@ -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",
|
||||
|
@@ -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",
|
||||
|
@@ -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",
|
||||
|
@@ -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",
|
||||
|
@@ -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",
|
||||
|
@@ -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",
|
||||
|
@@ -424,7 +424,8 @@
|
||||
"GRANTEDPROJECT": "グラントされたプロジェクト",
|
||||
"HUMANUSERS": "ユーザー",
|
||||
"MACHINEUSERS": "サービスユーザー",
|
||||
"LOGOUT": "すべてのユーザーをログアウトする",
|
||||
"LOGOUT": "ログアウト",
|
||||
"LOGOUTALL": "すべてのユーザーをログアウトする",
|
||||
"NEWORG": "新しい組織",
|
||||
"IAMADMIN": "あなたはIAM管理者です。広範囲の権限があることに注意してください。",
|
||||
"SHOWORGS": "すべての組織を表示する",
|
||||
|
@@ -424,7 +424,8 @@
|
||||
"GRANTEDPROJECT": "부여된 프로젝트",
|
||||
"HUMANUSERS": "사용자",
|
||||
"MACHINEUSERS": "서비스 사용자",
|
||||
"LOGOUT": "모든 사용자 로그아웃",
|
||||
"LOGOUT": "로그아웃",
|
||||
"LOGOUTALL": "모든 사용자 로그아웃",
|
||||
"NEWORG": "새 조직",
|
||||
"IAMADMIN": "IAM 관리자입니다. 확장된 권한이 부여되었습니다.",
|
||||
"SHOWORGS": "모든 조직 보기",
|
||||
|
@@ -424,7 +424,8 @@
|
||||
"GRANTEDPROJECT": "Доделени проекти",
|
||||
"HUMANUSERS": "Корисници",
|
||||
"MACHINEUSERS": "Сервисни корисници",
|
||||
"LOGOUT": "Одјави ги сите корисници",
|
||||
"LOGOUT": "Одјава",
|
||||
"LOGOUTALL": "Одјави ги сите корисници",
|
||||
"NEWORG": "Нова организација",
|
||||
"IAMADMIN": "Вие сте администратор на IAM. Имате проширени овластувања.",
|
||||
"SHOWORGS": "Прикажи ги сите организации",
|
||||
|
@@ -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",
|
||||
|
@@ -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",
|
||||
|
@@ -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",
|
||||
|
@@ -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",
|
||||
|
@@ -424,7 +424,8 @@
|
||||
"GRANTEDPROJECT": "Допуски проектов",
|
||||
"HUMANUSERS": "Пользователи",
|
||||
"MACHINEUSERS": "Служебные пользователи",
|
||||
"LOGOUT": "Выйти из всех пользователей",
|
||||
"LOGOUT": "Выйти",
|
||||
"LOGOUTALL": "Выйти из всех пользователей",
|
||||
"NEWORG": "Новая организация",
|
||||
"IAMADMIN": "Вы являетесь администратором IAM. Обратите внимание, что вы обладаете расширенными разрешениями.",
|
||||
"SHOWORGS": "Показать все организации",
|
||||
|
@@ -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",
|
||||
|
@@ -424,7 +424,8 @@
|
||||
"GRANTEDPROJECT": "已授予的项目",
|
||||
"HUMANUSERS": "用户",
|
||||
"MACHINEUSERS": "服务用户",
|
||||
"LOGOUT": "退出所有账户",
|
||||
"LOGOUT": "注销",
|
||||
"LOGOUTALL": "退出所有账户",
|
||||
"NEWORG": "创建组织",
|
||||
"IAMADMIN": "您是 IAM 管理员。请注意您具有扩展权限。",
|
||||
"SHOWORGS": "查看所有组织",
|
||||
|
Reference in New Issue
Block a user