Keycloak-Logout ohne User-Bestätigung: Eine Anleitung

tiny-tool.de

tiny-tool.de

In modernen Anwendungen ist die Abmeldung ein zentraler Bestandteil der Benutzerverwaltung. Im Kontext von OpenID Connect (OIDC) ist es jedoch Standard, dass Benutzer ihre Abmeldung explizit bestätigen müssen, wenn sie von einer Anwendung ausgeloggt werden. Dieser Ansatz dient der Sicherheit, da so sichergestellt wird, dass die Abmeldung durch den Benutzer und nicht durch ein unbefugtes Skript erfolgt.

Trotzdem gibt es zahlreiche Szenarien, in denen ein automatischer Logout ohne Benutzerinteraktion sinnvoll ist:

  • Automatisierte Abmeldung nach einem Timeout oder durch Administratoren.
  • Single Logout (SLO), bei dem Benutzer von mehreren Anwendungen gleichzeitig abgemeldet werden.
  • Optimierung von Benutzererfahrungen, indem unnötige Klicks eliminiert werden.

In diesem Artikel zeige ich, wie ein Keycloak-Logout ohne User-Bestätigung umgesetzt werden kann und warum der Parameter id_token_hint dabei eine zentrale Rolle spielt.

Warum ist der Logout-Standard auf Benutzerbestätigung ausgelegt?

OpenID Connect (OIDC) ist ein Authentifizierungsprotokoll, das stark auf Sicherheit ausgelegt ist. Der Logout-Standard fordert, dass Benutzer ihre Abmeldung bestätigen müssen, um:

  1. Missbrauch zu verhindern: Ein böswilliger Akteur könnte sonst den Benutzer ohne dessen Wissen ausloggen.
  2. Sicherheit zu erhöhen: Explizite Abmeldungen minimieren Risiken, die durch automatisierte Skripte entstehen.

Dieser Ansatz ist sinnvoll, birgt jedoch Herausforderungen für Szenarien, in denen ein vollautomatischer Logout ohne Benutzerbestätigung erforderlich ist.

Werbung/Advertising

Aromatico

Der Schlüssel: id_token_hint

Der Parameter id_token_hint ist eine wichtige Komponente des OIDC-Logouts. Er enthält den ID-Token des Benutzers, der beim Login von Keycloak oder einem anderen OIDC-Provider ausgegeben wurde.

Was ist der ID-Token?

Ein ID-Token ist ein JSON Web Token (JWT), das Informationen über den Benutzer enthält, wie z. B.:

  • sub: Die eindeutige Benutzer-ID.
  • iss: Der Aussteller des Tokens (z. B. die Keycloak-Instanz).
  • exp: Das Ablaufdatum des Tokens.
Warum ist der id_token_hint wichtig?

Beim Logout ohne Benutzerbestätigung wird der id_token_hint verwendet, um:

  1. Die Benutzer-Session zu identifizieren: Der Token hilft Keycloak, die richtige Session des Benutzers zu invalidieren.
  2. Sicherheitsanforderungen zu erfüllen: Der id_token_hint beweist, dass die Abmeldeanforderung von einer vertrauenswürdigen Quelle stammt.

Keycloak-Logout ohne Benutzerbestätigung

Ein Logout ohne Bestätigung erfordert, dass alle relevanten Informationen an Keycloak übergeben werden. Neben dem id_token_hint sind folgende Parameter entscheidend:

  • sid: Die Session-ID, um die Benutzer-Session eindeutig zuzuordnen.
  • client_id: Die ID der Anwendung, die den Logout initiiert.
  • post_logout_redirect_uri: Die Ziel-URL, zu der der Benutzer nach dem Logout weitergeleitet wird.

Werbung/Advertising

<

Fujitsu Esprimo Q556 Intel Core i3 128GB SSD 4GB Windows 10 Home DVD Brenner

Fujitsu Esprimo Q556 Intel Core i3 128GB SSD 4GB Windows 10 Home DVD Brenner

Preis: 199,00 EUR

Zum Angebot
🔥 Bestseller

Lenovo ThinkPad X1 Yoga Gen 7 14 Zoll Touch Display Intel Core i5 256GB SSD 32GB Windows 10 Pro LTE

Lenovo ThinkPad X1 Yoga Gen 7 14 Zoll Touch Display Intel Core i5 256GB SSD 32GB Windows 10 Pro LTE

Preis: 869,00 EUR

Zum Angebot

Eizo FlexScan EV2436W-BK schwarz 24 Zoll WUXGA 1920x1200 DisplayPort DVI Höhenverstellbar

Eizo FlexScan EV2436W-BK schwarz 24 Zoll WUXGA 1920x1200 DisplayPort DVI Höhenverstellbar

Preis: 129,00 EUR

Zum Angebot

Apple iPhone X Smartphone Handy 5,8 Zoll 64GB Speicher Space Grau

Apple iPhone X Smartphone Handy 5,8 Zoll 64GB Speicher Space Grau

Preis: 229,00 EUR

Zum Angebot
🔥 Bestseller

HP EliteBook x360 830 G8 13,3 Zoll Touch Display Intel Core i5 256GB SSD 16GB Windows 10 Pro Webcam

HP EliteBook x360 830 G8 13,3 Zoll Touch Display Intel Core i5 256GB SSD 16GB Windows 10 Pro Webcam

Preis: 629,00 EUR

Zum Angebot

MSA-1 Monitorschwenkarm High Quality, Aluminium silbergrau, inkl. Tischbefestigung

MSA-1 Monitorschwenkarm High Quality, Aluminium silbergrau, inkl. Tischbefestigung

Preis: 169,00 EUR

Zum Angebot

Apple iPhone XR Smartphone Handy 6,1 Zoll 256GB Speicher Schwarz

Apple iPhone XR Smartphone Handy 6,1 Zoll 256GB Speicher Schwarz

Preis: 239,00 EUR

Zum Angebot

Fujitsu Esprimo P5010n Intel Core i5-10400 256GB SSD 16GB Windows 11 Pro

Fujitsu Esprimo P5010n Intel Core i5-10400 256GB SSD 16GB Windows 11 Pro

Preis: 419,00 EUR

Zum Angebot
🔥 Bestseller

Lenovo ThinkPad P53 15,6 Zoll 1920x1080 Full HD Intel Core i7 512GB SSD 32GB Windows 11 Pro Nvidia Quadro

Lenovo ThinkPad P53 15,6 Zoll 1920x1080 Full HD Intel Core i7 512GB SSD 32GB Windows 11 Pro Nvidia Quadro

Preis: 799,00 EUR

Zum Angebot
🔥 Bestseller

HP ZBook 15 G6 15,6 Zoll 1920x1080 Full HD Intel Core i7 512GB SSD 32GB Windows 11 Pro Nvidia Quadro

HP ZBook 15 G6 15,6 Zoll 1920x1080 Full HD Intel Core i7 512GB SSD 32GB Windows 11 Pro Nvidia Quadro

Preis: 779,00 EUR

Zum Angebot
🔥 Bestseller

HP EliteBook 840 G8 14 Zoll 1920x1080 Full HD Intel Core i5 256GB SSD 16GB Windows 10 Pro - Neugerät

HP EliteBook 840 G8 14 Zoll 1920x1080 Full HD Intel Core i5 256GB SSD 16GB Windows 10 Pro - Neugerät

Preis: 668,00 EUR

Zum Angebot
🔥 Bestseller

HP EliteBook 840 G6 14 Zoll 3840x2160 4K UHD Intel Core i7 1TB SSD 16GB Windows 11 Pro Webcam

HP EliteBook 840 G6 14 Zoll 3840x2160 4K UHD Intel Core i7 1TB SSD 16GB Windows 11 Pro Webcam

Preis: 699,00 EUR

Zum Angebot
🔥 Bestseller

HP ZBook Fury 15 G7 15,6 Zoll 1920x1080 Full HD Intel Core i7 512GB SSD 32GB Windows 11 Pro Nvidia Quadro

HP ZBook Fury 15 G7 15,6 Zoll 1920x1080 Full HD Intel Core i7 512GB SSD 32GB Windows 11 Pro Nvidia Quadro

Preis: 699,00 EUR

Zum Angebot

Eizo FlexScan EV2436WFS-GY Lichtgrau 24 Zoll WUXGA 1920x1200 DisplayPort DVI VGA

Eizo FlexScan EV2436WFS-GY Lichtgrau 24 Zoll WUXGA 1920x1200 DisplayPort DVI VGA

Preis: 139,00 EUR

Zum Angebot

Apple iPad Air 3 (2019) 10,5 Zoll 256GB Wi-Fi + Cellular Space Grau

Apple iPad Air 3 (2019) 10,5 Zoll 256GB Wi-Fi + Cellular Space Grau

Preis: 329,00 EUR

Zum Angebot
🔥 Bestseller

Lenovo ThinkPad P15 Gen 1 15,6 Zoll Full HD Intel Core i7 512GB SSD 32GB Windows 10 Pro Nvidia Quadro T2000

Lenovo ThinkPad P15 Gen 1 15,6 Zoll Full HD Intel Core i7 512GB SSD 32GB Windows 10 Pro Nvidia Quadro T2000

Preis: 879,00 EUR

Zum Angebot

Eizo FlexScan EV2456-BK schwarz 24 Zoll WUXGA 1920x1200 DisplayPort HDMI DVI-D VGA USB Höhenverstellbar

Eizo FlexScan EV2456-BK schwarz 24 Zoll WUXGA 1920x1200 DisplayPort HDMI DVI-D VGA USB Höhenverstellbar

Preis: 199,00 EUR

Zum Angebot
🔥 Bestseller

Lenovo ThinkPad P14s Gen 2 14 Zoll 1920x1080 Full HD Intel Core i5 512GB SSD 16GB Windows 11 Pro Fingerprint

Lenovo ThinkPad P14s Gen 2 14 Zoll 1920x1080 Full HD Intel Core i5 512GB SSD 16GB Windows 11 Pro Fingerprint

Preis: 729,00 EUR

Zum Angebot
🔥 Bestseller

Lenovo ThinkStation P520c Intel Xeon W-2133 512GB SSD 32GB Windows 11 Pro Nvidia Quadro P4000

Lenovo ThinkStation P520c Intel Xeon W-2133 512GB SSD 32GB Windows 11 Pro Nvidia Quadro P4000

Preis: 699,00 EUR

Zum Angebot

Apple iPhone X Smartphone Handy 5,8 Zoll 256GB Speicher Space Grau

Apple iPhone X Smartphone Handy 5,8 Zoll 256GB Speicher Space Grau

Preis: 339,00 EUR

Zum Angebot

Eizo FlexScan EV2736W-BK LED IPS 27 Zoll WQHD 2560x1440 DisplayPort DVI Schwarz

Eizo FlexScan EV2736W-BK LED IPS 27 Zoll WQHD 2560x1440 DisplayPort DVI Schwarz

Preis: 219,00 EUR

Zum Angebot
🔥 Bestseller

Lenovo ThinkVision P27h-10 schwarz 27 Zoll WQHD 2560x1440 HDMI DisplayPort USB Höhenverstellbar 61AFGAT1EU

Lenovo ThinkVision P27h-10 schwarz 27 Zoll WQHD 2560x1440 HDMI DisplayPort USB Höhenverstellbar 61AFGAT1EU

Preis: 219,00 EUR

Zum Angebot
🔥 Bestseller

HP EliteBook 840 G7 14 Zoll 1920x1080 Full HD Intel Core i7 512GB SSD 32GB Windows 10 Pro LTE

HP EliteBook 840 G7 14 Zoll 1920x1080 Full HD Intel Core i7 512GB SSD 32GB Windows 10 Pro LTE

Preis: 758,00 EUR

Zum Angebot

Fujitsu Celsius M740 Intel Xeon Quad Core E5 v4 512GB SSD 32GB Windows 10 Pro Nvidia Quadro

Fujitsu Celsius M740 Intel Xeon Quad Core E5 v4 512GB SSD 32GB Windows 10 Pro Nvidia Quadro

Preis: 719,00 EUR

Zum Angebot
🔥 Bestseller

Lenovo ThinkPad P15 Gen 1 15,6 Zoll Full HD Intel Core i7 512GB SSD 32GB Windows 11 Pro Nvidia Quadro T2000

Lenovo ThinkPad P15 Gen 1 15,6 Zoll Full HD Intel Core i7 512GB SSD 32GB Windows 11 Pro Nvidia Quadro T2000

Preis: 879,00 EUR

Zum Angebot
🔥 Bestseller

Lenovo ThinkPad X1 Yoga Gen 7 14 Zoll Touch Display Intel Core i5 256GB SSD 32GB Windows 11 Pro LTE

Lenovo ThinkPad X1 Yoga Gen 7 14 Zoll Touch Display Intel Core i5 256GB SSD 32GB Windows 11 Pro LTE

Preis: 859,00 EUR

Zum Angebot
🔥 Bestseller

HP ZBook Fury 15 G8 15,6 Zoll 1920x1080 Full HD Intel Core i7 512GB SSD 32GB Windows 10 Pro Nvidia Quadro T1200

HP ZBook Fury 15 G8 15,6 Zoll 1920x1080 Full HD Intel Core i7 512GB SSD 32GB Windows 10 Pro Nvidia Quadro T1200

Preis: 759,00 EUR

Zum Angebot
🔥 Bestseller

Lenovo ThinkCentre neo 50q Gen 4 Intel Core i5-13420H 256GB SSD 16GB Windows 11 Pro inkl. W-Lan - Neugerät

Lenovo ThinkCentre neo 50q Gen 4 Intel Core i5-13420H 256GB SSD 16GB Windows 11 Pro inkl. W-Lan - Neugerät

Preis: 659,00 EUR

Zum Angebot

Fujitsu Esprimo Q957 Intel Core i3 128GB SSD + 500GB HDD 8GB Windows 10 Home

Fujitsu Esprimo Q957 Intel Core i3 128GB SSD + 500GB HDD 8GB Windows 10 Home

Preis: 219,00 EUR

Zum Angebot

Fujitsu Esprimo P757 E85+ Intel Quad Core i5 512GB SSD 16GB Windows 10 Home DVD Brenner

Fujitsu Esprimo P757 E85+ Intel Quad Core i5 512GB SSD 16GB Windows 10 Home DVD Brenner

Preis: 249,00 EUR

Zum Angebot

Fujitsu Esprimo P757 E85+ Intel Quad Core i5 512GB SSD 16GB Windows 10 Pro DVD Brenner

Fujitsu Esprimo P757 E85+ Intel Quad Core i5 512GB SSD 16GB Windows 10 Pro DVD Brenner

Preis: 269,00 EUR

Zum Angebot
🔥 Bestseller

Dell P2419HC schwarz 23,8 Zoll Full HD 1920x1080 DisplayPort HDMI USB Höhenverstellbar

Dell P2419HC schwarz 23,8 Zoll Full HD 1920x1080 DisplayPort HDMI USB Höhenverstellbar

Preis: 149,00 EUR

Zum Angebot
🔥 Bestseller

Lenovo Thinkpad Thunderbolt 3 Dock 40AC Dockingstation inkl. 135 Watt Netzteil inkl. USB-C Kabel

Lenovo Thinkpad Thunderbolt 3 Dock 40AC Dockingstation inkl. 135 Watt Netzteil inkl. USB-C Kabel

Preis: 129,00 EUR

Zum Angebot

Microsoft 365 Business Standard Office - 1 Nutzer

Microsoft 365 Business Standard Office - 1 Nutzer

Preis: 129,00 EUR

Zum Angebot

Apple iPhone XR Smartphone Handy 6,1 Zoll 128GB Speicher Schwarz

Apple iPhone XR Smartphone Handy 6,1 Zoll 128GB Speicher Schwarz

Preis: 229,00 EUR

Zum Angebot
🔥 Bestseller

Lenovo ThinkPad P15 Gen 1 15,6 Zoll Full HD Intel Core i7 512GB SSD 32GB Windows 11 Pro Nvidia Quadro T1000

Lenovo ThinkPad P15 Gen 1 15,6 Zoll Full HD Intel Core i7 512GB SSD 32GB Windows 11 Pro Nvidia Quadro T1000

Preis: 859,00 EUR

Zum Angebot
🔥 Bestseller

Lenovo ThinkCentre M70q Gen 5 Tiny Intel Core i5 256GB SSD 16GB Windows 11 Pro inkl. W-Lan - Neugerät

Lenovo ThinkCentre M70q Gen 5 Tiny Intel Core i5 256GB SSD 16GB Windows 11 Pro inkl. W-Lan - Neugerät

Preis: 749,00 EUR

Zum Angebot
🔥 Bestseller

Lenovo ThinkVision T24d-10 schwarz 24 Zoll WUXGA 1920x1200 HDMI DisplayPort VGA Höhenverstellbar

Lenovo ThinkVision T24d-10 schwarz 24 Zoll WUXGA 1920x1200 HDMI DisplayPort VGA Höhenverstellbar

Preis: 159,00 EUR

Zum Angebot
🔥 Bestseller

Lenovo ThinkPad Thunderbolt 3 Dock 40AC Dockingstation inkl. 135 Watt Netzteil inkl. USB-C Kabel 40AC0135EU

Lenovo ThinkPad Thunderbolt 3 Dock 40AC Dockingstation inkl. 135 Watt Netzteil inkl. USB-C Kabel 40AC0135EU

Preis: 119,00 EUR

Zum Angebot

Philips V-Line 243V7QDSB 24 Zoll Full HD 1920x1080 IPS VGA DVI HDMI Schwarz NEU & OVP

Philips V-Line 243V7QDSB 24 Zoll Full HD 1920x1080 IPS VGA DVI HDMI Schwarz NEU & OVP

Preis: 139,00 EUR

Zum Angebot
🔥 Bestseller

Lenovo ThinkVision T24v-10 schwarz 23,8 Zoll Full HD 1920x1080 HDMI DisplayPort VGA Höhenverstellbar 61BCMAR6EU

Lenovo ThinkVision T24v-10 schwarz 23,8 Zoll Full HD 1920x1080 HDMI DisplayPort VGA Höhenverstellbar 61BCMAR6EU

Preis: 149,00 EUR

Zum Angebot
🔥 Bestseller

Acer B246HYLBymiprx dunkelgrau 23,8 Zoll Full HD 1920x1080 DisplayPort HDMI VGA Höhenverstellbar UM.QB6EE.A05

Acer B246HYLBymiprx dunkelgrau 23,8 Zoll Full HD 1920x1080 DisplayPort HDMI VGA Höhenverstellbar UM.QB6EE.A05

Preis: 119,00 EUR

Zum Angebot
🔥 Bestseller

Lenovo Thinkpad Thunderbolt 3 Dock 40AC Dockingstation inkl. 135 Watt Netzteil inkl. USB-C Kabel 40AC0135EU

Lenovo Thinkpad Thunderbolt 3 Dock 40AC Dockingstation inkl. 135 Watt Netzteil inkl. USB-C Kabel 40AC0135EU

Preis: 119,00 EUR

Zum Angebot
🔥 Bestseller

Dell Optiplex 7060 Micro Intel Core i5-8500 256GB SSD 16GB Windows 11 Pro

Dell Optiplex 7060 Micro Intel Core i5-8500 256GB SSD 16GB Windows 11 Pro

Preis: 349,00 EUR

Zum Angebot

Fujitsu Display B22-8 WE Neo 22 Zoll HD+ 1680x1050 DisplayPort DVI-D VGA Höhenverstellbar NEU & OVP

Fujitsu Display B22-8 WE Neo 22 Zoll HD+ 1680x1050 DisplayPort DVI-D VGA Höhenverstellbar NEU & OVP

Preis: 139,00 EUR

Zum Angebot
🔥 Bestseller

Lenovo ThinkPad USB-C Dock Gen 2 40AS Dockingstation inkl. 90 Watt Netzteil 40AS0090EU 03X7609

Lenovo ThinkPad USB-C Dock Gen 2 40AS Dockingstation inkl. 90 Watt Netzteil 40AS0090EU 03X7609

Preis: 109,00 EUR

Zum Angebot

Fujitsu Esprimo D956 E85+ Desktop Intel Quad Core i5 256GB SSD 8GB Windows 10 Home

Fujitsu Esprimo D956 E85+ Desktop Intel Quad Core i5 256GB SSD 8GB Windows 10 Home

Preis: 219,00 EUR

Zum Angebot

Fujitsu Esprimo D956 E85+ Desktop Intel Quad Core i5 256GB SSD 8GB Windows 10 Pro

Fujitsu Esprimo D956 E85+ Desktop Intel Quad Core i5 256GB SSD 8GB Windows 10 Pro

Preis: 269,00 EUR

Zum Angebot
🔥 Bestseller

Lenovo ThinkPad L15 Gen 3 15,6 Zoll 1920x1080 Full HD AMD Ryzen 5 PRO 512GB SSD 16GB Windows 11 Pro Fingerprint

Lenovo ThinkPad L15 Gen 3 15,6 Zoll 1920x1080 Full HD AMD Ryzen 5 PRO 512GB SSD 16GB Windows 11 Pro Fingerprint

Preis: 709,00 EUR

Zum Angebot
🔥 Bestseller

Lenovo ThinkCentre neo 50q Gen 4 Intel Core i5-13420H 512GB SSD 16GB Windows 11 Pro inkl. W-Lan - Neugerät

Lenovo ThinkCentre neo 50q Gen 4 Intel Core i5-13420H 512GB SSD 16GB Windows 11 Pro inkl. W-Lan - Neugerät

Preis: 679,00 EUR

Zum Angebot
🔥 Bestseller

Lenovo ThinkCentre neo 50q Gen 4 Intel Core i5-13420H 256GB SSD 8GB Windows 11 Pro inkl. W-Lan - Neugerät

Lenovo ThinkCentre neo 50q Gen 4 Intel Core i5-13420H 256GB SSD 8GB Windows 11 Pro inkl. W-Lan - Neugerät

Preis: 639,00 EUR

Zum Angebot

Apple iPhone 11 Smartphone Handy 6,1 Zoll 128GB Speicher Schwarz

Apple iPhone 11 Smartphone Handy 6,1 Zoll 128GB Speicher Schwarz

Preis: 309,00 EUR

Zum Angebot
🔥 Bestseller

Lenovo ThinkStation P330 Tower Gen 2 Intel Core i7 512GB SSD 32GB Windows 11 Pro Nvidia Quadro RTX 4000

Lenovo ThinkStation P330 Tower Gen 2 Intel Core i7 512GB SSD 32GB Windows 11 Pro Nvidia Quadro RTX 4000

Preis: 899,00 EUR

Zum Angebot
🔥 Bestseller

HP ZBook Fury 15 G7 15,6 Zoll 1920x1080 Full HD Intel Core i7 512GB SSD 32GB Windows 11 Pro Nvidia Quadro T1000

HP ZBook Fury 15 G7 15,6 Zoll 1920x1080 Full HD Intel Core i7 512GB SSD 32GB Windows 11 Pro Nvidia Quadro T1000

Preis: 879,00 EUR

Zum Angebot
🔥 Bestseller

HP ZBook 15 G6 15,6 Zoll 1920x1080 Full HD Intel Core i7 512GB SSD 16GB Windows 10 Pro

HP ZBook 15 G6 15,6 Zoll 1920x1080 Full HD Intel Core i7 512GB SSD 16GB Windows 10 Pro

Preis: 848,00 EUR

Zum Angebot

Fujitsu Esprimo D756 E85+ Intel Pentium G4400 256GB SSD 4GB Windows 10 Pro DVD Brenner

Fujitsu Esprimo D756 E85+ Intel Pentium G4400 256GB SSD 4GB Windows 10 Pro DVD Brenner

Preis: 219,00 EUR

Zum Angebot
🔥 Bestseller

Lenovo ThinkCentre Tiny-in-One 24 Gen 4 schwarz 23,8 Zoll Full HD 1920x1080 DisplayPort inkl. Webcam - Neugerät

Lenovo ThinkCentre Tiny-in-One 24 Gen 4 schwarz 23,8 Zoll Full HD 1920x1080 DisplayPort inkl. Webcam - Neugerät

Preis: 269,00 EUR

Zum Angebot

LG 24BK550Y-B 24 Zoll Full HD 1920x1080 VGA DVI DisplayPort HDMI Höhenverstellbar Schwarz

LG 24BK550Y-B 24 Zoll Full HD 1920x1080 VGA DVI DisplayPort HDMI Höhenverstellbar Schwarz

Preis: 129,00 EUR

Zum Angebot

Apple iPhone XR Smartphone Handy 6,1 Zoll 64GB Speicher Schwarz

Apple iPhone XR Smartphone Handy 6,1 Zoll 64GB Speicher Schwarz

Preis: 189,00 EUR

Zum Angebot
🔥 Bestseller

Lenovo ThinkPad P14s Gen 2 14 Zoll 1920x1080 Full HD Intel Core i5 512GB SSD 24GB Windows 11 Pro Nvidia Quadro

Lenovo ThinkPad P14s Gen 2 14 Zoll 1920x1080 Full HD Intel Core i5 512GB SSD 24GB Windows 11 Pro Nvidia Quadro

Preis: 719,00 EUR

Zum Angebot
🔥 Bestseller

Lenovo ThinkStation P520c Intel Xeon W-2133 512GB SSD 32GB Windows 10 Pro Nvidia Quadro P4000

Lenovo ThinkStation P520c Intel Xeon W-2133 512GB SSD 32GB Windows 10 Pro Nvidia Quadro P4000

Preis: 699,00 EUR

Zum Angebot

Apple iPhone SE (2022) 64GB Dual-SIM Mitternacht MMXF3ZD/A

Apple iPhone SE (2022) 64GB Dual-SIM Mitternacht MMXF3ZD/A

Preis: 279,00 EUR

Zum Angebot
🔥 Bestseller

Lenovo ThinkVision T24v-10 schwarz 23,8 Zoll Full HD 1920x1080 HDMI DisplayPort VGA Höhenverstellbar 61BCMAR6

Lenovo ThinkVision T24v-10 schwarz 23,8 Zoll Full HD 1920x1080 HDMI DisplayPort VGA Höhenverstellbar 61BCMAR6

Preis: 169,00 EUR

Zum Angebot
🔥 Bestseller

Lenovo ThinkCentre Tiny-in-One 24 Gen 4 schwarz 23,8 Zoll Full HD 1920x1080 DisplayPort inkl. Webcam

Lenovo ThinkCentre Tiny-in-One 24 Gen 4 schwarz 23,8 Zoll Full HD 1920x1080 DisplayPort inkl. Webcam

Preis: 188,00 EUR

Zum Angebot

Apple iPad 6 Tablet 9,7 Zoll Retina Multi-Touch 32GB SSD Wi-Fi + Cellular Space Grau

Apple iPad 6 Tablet 9,7 Zoll Retina Multi-Touch 32GB SSD Wi-Fi + Cellular Space Grau

Preis: 199,00 EUR

Zum Angebot
🔥 Bestseller

Lenovo ThinkStation P520 Intel Xeon W-2135 1TB SSD 64GB Windows 11 Pro Nvidia Geforce RTX 2080

Lenovo ThinkStation P520 Intel Xeon W-2135 1TB SSD 64GB Windows 11 Pro Nvidia Geforce RTX 2080

Preis: 919,00 EUR

Zum Angebot
🔥 Bestseller

Lenovo ThinkPad L14 Gen 3 14 Zoll Touch Display AMD Ryzen 7 PRO 512GB SSD 16GB Windows 11 Pro Webcam

Lenovo ThinkPad L14 Gen 3 14 Zoll Touch Display AMD Ryzen 7 PRO 512GB SSD 16GB Windows 11 Pro Webcam

Preis: 709,00 EUR

Zum Angebot
🔥 Bestseller

HP ZBook Firefly 14 G9 14 Zoll 1920x1200 WUXGA Intel Core i7 512GB SSD 16GB Windows 10 Pro Fingerprint

HP ZBook Firefly 14 G9 14 Zoll 1920x1200 WUXGA Intel Core i7 512GB SSD 16GB Windows 10 Pro Fingerprint

Preis: 679,00 EUR

Zum Angebot

AOC I2475PXQU-GR Pro-line LED grau 23,8 Zoll Full HD 1920x1080 DisplayPort HDMI DVI-D VGA USB Höhenverstellbar

AOC I2475PXQU-GR Pro-line LED grau 23,8 Zoll Full HD 1920x1080 DisplayPort HDMI DVI-D VGA USB Höhenverstellbar

Preis: 119,00 EUR

Zum Angebot

Apple iPad 7 Tablet 10,2 Zoll Retina Multi-Touch 128GB SSD Wi-Fi + Cellular Space Grau

Apple iPad 7 Tablet 10,2 Zoll Retina Multi-Touch 128GB SSD Wi-Fi + Cellular Space Grau

Preis: 259,00 EUR

Zum Angebot
🔥 Bestseller

Lenovo ThinkStation P720 2x Intel Xeon Gold 5122 1TB SSD 64GB Windows 11 Pro Nvidia Quadro P4000 inkl. W-Lan

Lenovo ThinkStation P720 2x Intel Xeon Gold 5122 1TB SSD 64GB Windows 11 Pro Nvidia Quadro P4000 inkl. W-Lan

Preis: 899,00 EUR

Zum Angebot
🔥 Bestseller

Lenovo ThinkCentre M70q Gen 5 Tiny Intel Core i5 256GB SSD 8GB Windows 11 Pro inkl. W-Lan - Neugerät

Lenovo ThinkCentre M70q Gen 5 Tiny Intel Core i5 256GB SSD 8GB Windows 11 Pro inkl. W-Lan - Neugerät

Preis: 719,00 EUR

Zum Angebot
>

Codebeispiel: Implementierung in Spring Boot


https://github.com/gzeuner/zeus-keycloak-demo
tiny-tool.de

tiny-tool.de

Code Highlighting
@GetMapping("/logoutWithoutConfirmation")
public void logoutWithoutConfirmation(HttpServletRequest request, HttpServletResponse response) throws IOException {
    // Extract required parameters
    String idToken = tokenUtils.getIdToken();
    String sessionId = tokenUtils.getSessionId();
    String clientId = tokenUtils.getClientId();
    String userId = tokenUtils.getUserId();
    if (idToken == null || sessionId == null || clientId == null || userId == null) {
        log.error("Missing required information for logout: idToken={}, sessionId={}, clientId={}, userId={}",
            idToken, sessionId, clientId, userId);
        throw new IllegalStateException("Missing required information for logout.");
    }
    // Dynamically build the Keycloak logout URL
    String logoutUrl = String.format(
        "%s?id_token_hint=%s&sid=%s&client_id=%s&user_id=%s&post_logout_redirect_uri=%s",
        keycloakLogoutUrl,
        idToken,
        sessionId,
        clientId,
        userId,
        postLogoutRedirectUri
    );
    // Invalidate the Spring Security context and session
    SecurityContextLogoutHandler logoutHandler = new SecurityContextLogoutHandler();
    logoutHandler.logout(request, response, null);
    boolean sessionInvalidated = request.getSession(false) == null;
    log.info("Spring Session invalidated: {}", sessionInvalidated);
    // Redirect to Keycloak logout URL
    response.sendRedirect(logoutUrl);
}

Werbung/Advertising

Aromatico

Warum id_token_hint ?

Der id_token_hint spielt eine zentrale Rolle bei der automatisierten Abmeldung in OpenID Connect (OIDC). Ohne diesen Parameter muss der Benutzer die Abmeldung explizit bestätigen, da der Identity Provider (IDP), wie z. B. Keycloak, die Benutzer-Session nicht automatisch zuordnen kann. Der id_token_hint enthält wichtige Informationen wie die Benutzer-ID (sub) und die Session-ID (sid), die es dem IDP ermöglichen, die korrekte Session sicher und präzise zu identifizieren und zu beenden.

Darüber hinaus trägt der id_token_hint zur Sicherheit bei, da nur vertrauenswürdige Clients Zugriff auf den ID-Token haben und diesen Parameter verwenden können. Das ermöglicht nicht nur eine zuverlässige Authentifizierung der Logout-Anforderung, sondern auch eine nahtlose Abmeldung, ohne dass der Benutzer aktiv eingreifen muss.

Hinweis: Abhängig vom verwendeten Identity Provider (IDP) sind möglicherweise nicht alle im Beispiel gezeigten Parameter erforderlich. Einige Parameter, wie die sid (Session-ID) oder die client_id, könnten optional sein. Das Beispiel soll jedoch verdeutlichen, wie man mithilfe von Tools wie der TokenUtils-Klasse Zugriff auf die Inhalte eines Tokens erhält, um diese flexibel für unterschiedliche Anforderungen zu nutzen.

Weitere Ressourcen

Werbung/Advertising

Aromatico