Package com.mozilla.bespin

Examples of com.mozilla.bespin.UserSession


    /**
     * Return the settings for the current user; returns null if there is no current user
     * @return
     */
    protected synchronized Map<String, String> getUserSettings() {
        UserSession session = (UserSession) getCtx().getReq().getSession(true).getAttribute("userSession");
        if (session == null) return null;
        Map<UserSession, Map<String, String>> settingsMap = (Map<UserSession, Map<String, String>>) getCtx().getServletContext().getAttribute(KEY_USER_SETTINGS);
        if (settingsMap == null) {
            settingsMap = new HashMap<UserSession, Map<String, String>>();
            getCtx().getServletContext().setAttribute(KEY_USER_SETTINGS, settingsMap);
View Full Code Here


        print("({ 'username':" + username + ", 'project':" + "'secret'})");
    }

    @RequiresLogin
    public void userinfo() {
        UserSession session = (UserSession) getCtx().getReq().getSession(true).getAttribute("userSession");
        // TODO do the same sha1 has as the python clent
        this.printUserJSON(session.username);
    }
View Full Code Here

        if (password == null) {
            password = "";
        }

        // -- if you are already logged in return
        UserSession session = (UserSession) getCtx().getReq().getSession(true).getAttribute("userSession");
        if (session != null && session.username.equals(username)) {
            this.printUserJSON(session.username);
        } else {
            String result = getAuthenticator().authenticate(getCtx(), username, password);
            if (result != null) {
View Full Code Here

    /**
     * Helper to handle the stored logged in user
     */
    private void storeLoggedInUser(String username) {
        UserSession session = new UserSession();
        session.username = username;
        getCtx().getReq().getSession(true).setAttribute("userSession", session);
    }
View Full Code Here

    public void handler() {
        printStatus();
    }

    private void printStatus() {
        UserSession session = (UserSession) getCtx().getReq().getSession(true).getAttribute("userSession");

        if (session == null) {
            print(UserSession.MESSAGE_NOT_LOGGED_IN);
            return;
        }
View Full Code Here

TOP

Related Classes of com.mozilla.bespin.UserSession

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.