This example checks the required digidaccess content access level of the current item (security.contentaccess.getaccesslevel()) and when this is below the current level (digid.currentlevel()), the user is redirected to the item with code DIGID_LOGIN (digid.redirecttologin()).
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.