This example resembles the sxml logic for a DigiD logoff page. First sessions are enabled using the viper session.enable(), since DigiD requires a session.
Then the digid.logoff() viper is called to end the DigiD session. Internally, the DigiD token and session variables are removed as well as setting the DigiD cookie to expired.
Then the user is redirected to a status page (item with code STATUSINFO), passing DIGID_LOGOFF as status parameter.
This is an example which can be used within a render template for a channel which should use DigiD authentication.
It uses a se:switch statement to handle login and logoff dependent on the query-string parameter(s) and it assumes there's a Page-scoped buffer with the name targeturl.