Package com.jetdrone.vertx.yoke.core

Examples of com.jetdrone.vertx.yoke.core.YokeCookie


    }

    @Override
    public void handle(@NotNull final YokeRequest request, @NotNull final Handler<Object> next) {
        // default session
        final YokeCookie cookie = new YokeCookie(name, hmacSHA256);
        cookie.setPath(path);
        cookie.setHttpOnly(httpOnly);
        cookie.setMaxAge(maxAge);

        // path validation mismatch
        if (request.normalizedPath().indexOf(cookie.getPath()) != 0) {
            next.handle(null);
            return;
        }

        // find the session cookie
        final YokeCookie sessionCookie = request.getCookie(name);
        final YokeResponse response = request.response();

        int hash = 0;
        String unsigned = null;

        if (sessionCookie != null) {
            // session cookies must be signed
            if (sessionCookie.isSigned()) {
                unsigned = sessionCookie.getUnsignedValue();
                if (unsigned != null) {
                    hash = crc16(unsigned);
                }
            }
        }
View Full Code Here


        if (cookieHeader != null) {
            Set<Cookie> nettyCookies = CookieDecoder.decode(cookieHeader);
            Set<YokeCookie> cookies = new TreeSet<>();

            for (Cookie cookie : nettyCookies) {
                YokeCookie yokeCookie = new YokeCookie(cookie, mac);
                String value = yokeCookie.getUnsignedValue();
                // value cannot be null in a cookie if the signature is mismatch then this value will be null
                // in that case the cookie has been tampered
                if (value == null) {
                    next.handle(400);
                    return;
View Full Code Here

TOP

Related Classes of com.jetdrone.vertx.yoke.core.YokeCookie

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.