function importFromCookie() {
                var sessionCookie = Cookie.getItem(cookieName);

                if (!sessionCookie) {
                    return null;
                }
                // first pass just break out the string into fields.
                var session = decodeToken(sessionCookie);

                if (!(session.kbase_sessionid && session.un && session.user_id && session.token)) {
                    removeSession();
                    return null;
                }
                session.token = session.token.replace(/PIPESIGN/g, '|').replace(/EQUALSSIGN/g, '=');

                // Ensure that we have localStorage.
//                var storageSessionString = localStorage.getItem(cookieName);
//                if (!storageSessionString) {
//                    Logger.logWarning('Local Storage Cookie missing -- resetting session');
//                    removeSession();
//                    return null;
//                }

//                var storageSession = JSON.parse(storageSessionString);
//                if (session.token !== storageSession.token) {
//                    Logger.logWarning('Local Storage Cookie token different than cookie token -- resetting session');
//                    removeSession();
//                    return null;
//                }

                // now we have a session object equivalent to the one returned by the auth service.
                var newSession = {
                    username: session.user_id,
                    token: session.token,
                    tokenObject: decodeToken(session.token),
                    sessionId: session.kbase_sessionid
                };

                if (validateSession(newSession)) {
                    return newSession;
                } else {
                    return null;
                }
            }
/**
             * Extract the cookie from the browser environment, parse it, and 
             * validate it. This is the canonical interface betweek KBase ui
             * code and browser authentication.
             * 
             * @function importSessionFromCookie
             * @private
             * 
             * @returns {SessionObject|null} a kbase session object or null
             * if there is no valid session cookie.
             */
Extract the cookie from the browser environment, parse it, and
validate it. This is the canonical interface betweek KBase ui
code and browser authentication.



@returns {SessionObject|null} a kbase session object or null
if there is no valid session cookie.
Extract the cookie from the browser environment parse it and validate it . This is the canonical interface betweek KBase ui code and browser authentication . @returns { SessionObject|null } a kbase session object or null if there is no valid session cookie .
function importFromCookie() {
                var sessionCookie = Cookie.getItem(cookieName);
                if (!sessionCookie) {
                    return null;
                }
                var session = decodeToken(sessionCookie);
                if (!(session.kbase_sessionid && session.un && session.user_id && session.token)) {
                    removeSession();
                    return null;
                }
                session.token = session.token.replace(/PIPESIGN/g, '|').replace(/EQUALSSIGN/g, '=');
                var newSession = {
                    username: session.user_id,
                    token: session.token,
                    tokenObject: decodeToken(session.token),
                    sessionId: session.kbase_sessionid
                };
                if (validateSession(newSession)) {
                    return newSession;
                } else {
                    return null;
                }
            }
function importFromCookie ( ) { var sessionCookie = Cookie . getItem ( cookieName ) ; if ( ! sessionCookie ) { return null ; } var session = decodeToken ( sessionCookie ) ; if ( ! ( session . kbase_sessionid && session . un && session . user_id && session . token ) ) { removeSession ( ) ; return null ; } session . token = session . token . replace ( / PIPESIGN / g , '|' ) . replace ( / EQUALSSIGN / g , '=' ) ; var newSession = { username : session . user_id , token : session . token , tokenObject : decodeToken ( session . token ) , sessionId : session . kbase_sessionid } ; if ( validateSession ( newSession ) ) { return newSession ; } else { return null ; } }
Extract the cookie from the browser environment, parse it, and
 validate it.
Extract the cookie from the browser environment parse it and validate it .
// first pass just break out the string into fields. // Ensure that we have localStorage. //                var storageSessionString = localStorage.getItem(cookieName); //                if (!storageSessionString) { //                    Logger.logWarning('Local Storage Cookie missing -- resetting session'); //                    removeSession(); //                    return null; //                } //                var storageSession = JSON.parse(storageSessionString); //                if (session.token !== storageSession.token) { //                    Logger.logWarning('Local Storage Cookie token different than cookie token -- resetting session'); //                    removeSession(); //                    return null; //                } // now we have a session object equivalent to the one returned by the auth service.