...
Code Block |
---|
<!DOCTYPE html> <html> <head> ... </head> <body> ... <a id="login-button" href="/login">Login</a> <a id="logout-button" href="/logout">Logout</a> ... <script type="text/javascript"> // Capture any widget that is present or will be present on the webpage. vl.widget.client.capture(function (widget) { // Only process the widget if widget is a global header. if (widget.getPluginTypeId() === 'global_header') { // Get the Citizen Profile Session extension from the global header widget. widget.getExtension('citizen_profile.session').then(function (session) { // Ensure the fallback login button uses the session instead of redirect to login page. document.getElementById('login-button').addEventListener('click', function (event) { // Start the login flow using the Citizen Profile Session extension. session.login(); // Prevent default behavior as the redirect is no longer required. event.preventDefault(); }); // Ensure the fallback logout button uses the session instead of redirect to // logout page. document.getElementById('logout-button').addEventListener('click', function (event) { // Start the logout flow using the Citizen Profile Session extension. session.logout(); // Prevent default behavior as the redirect is no longer required. event.preventDefault(); }); // This variable is purely to indicate which values are allowed (true / false). var websiteHasAuthenticatedSession = false; // Inform the session extension about the current session state of the website. Keep in mind // this operation can only be performed once on every page load. session.configure({ active: websiteHasAuthenticatedSession }); }); } }); </script> </body> </html> |
Fallback in SSO-callbackpagina
De featuredetectie is voldoende voor de Mijn Burgerprofiel-extensie om de aanmeld- en afmeldflows te starten.
...