<!DOCTYPE html>
<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link rel="shortcut icon" href="/favicon.ico" title="Favicon">
    <title>Spring Security SSO Client 2</title>
    <link rel="stylesheet"
          href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css" />
</head>

<body>
<div class="container">
    <div class="col-sm-12">
        <h1>Spring Security SSO and logout</h1>
        <form name="logout_form" id="logout_form" method="post" action="/logout1">
            <input type="hidden" name="scope" value="read">

            <input type="submit" value="Logout"/>
        </form>

        <a href="#" onclick="login()"><font

                class="lightTextLarge">Log Out</font></a>

        <a href="#" onclick="logout()"><font

                class="lightTextLarge">Log Out</font></a>

    </div>
</div>
</body>
<script type="text/javascript">
            function setTimeZoneInCookie() {
                console.log("creando cookie");
                var _myDate = new Date();
                var _offset = _myDate.getTimezoneOffset();
                document.cookie = "TIMEZONE_COOKIE=" + _offset; //Cookie name with value
            }
            setTimeZoneInCookie();

            function readCookie(name) {
                return (name = new RegExp('(?:^|;\\s*)' + ('' + name).replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&') + '=([^;]*)').exec(document.cookie)) && name[1];
            }
            console.log(document.cookie);

            function login() {
                window.location.href='mylogin';
                }

            function logout() {
                var url = 'https://idcs-204e4341c8eb4484b0edba0934b4d507.identity.oraclecloud.com/oauth2/v1/userlogout?post_logout_redirect_uri=http://localhost:8080/logout&id_token_hint='+readCookie('XSRF-TOKEN');
                window.location.href = url;
            }
        </script>
</html>