Package org.apache.turbine.om.security

Examples of org.apache.turbine.om.security.User


    public void testForcePassword()
      throws Exception
    {
        SecurityService ss = TurbineSecurity.getService();

        User admin = ss.getUser("admin");
        assertNotNull(admin);

        ss.forcePassword(admin, "barbaz");

        User admin2 = ss.getUser("admin");
        assertEquals("Password was not changed!", "barbaz", admin2.getPassword());

        ss.forcePassword(admin, "admin");

        admin2 = ss.getUser("admin");
        assertEquals("Password was not reset!", "admin", admin2.getPassword());


        checkUserList();
    }
View Full Code Here


        //
        // Session Tool start right at the session once the user has been set
        // while persistent and authorized Tools are started when the user has
        // logged in
        //
        User user = data.getUser();

        // Note: Session tools are currently lost after the login action
        // because the anonymous user is replaced the the real user object.
        // We should either store the session pull tools in the session or
        // make Turbine.loginAction() copy the session pull tools into the
        // new user object.
        populateWithSessionTools(sessionTools, context, data, user);

        if (!TurbineSecurity.isAnonymousUser(user))
        {
            if (user.hasLoggedIn())
            {
                populateWithSessionTools(authorizedTools, context, data, user);
                populateWithPermTools(persistentTools, context, data, user);
            }
        }
View Full Code Here

        UserManager um = ss.getUserManager();

        assertTrue(um.accountExists("admin"));
        assertFalse(um.accountExists("does-not-exist"));

        User admin = um.retrieve("admin");
        assertTrue(um.accountExists(admin));

        User doesNotExist = TurbineSecurity.getUserInstance();
        assertFalse(um.accountExists(doesNotExist));

        checkUserList();
    }
View Full Code Here

      throws Exception
    {
        SecurityService ss = TurbineSecurity.getService();
        UserManager um = ss.getUserManager();

        User admin = um.retrieve("admin");

        try
        {
            User doesNotExist = um.retrieve("does-not-exist");
            fail("Non existing Account was retrieved");
        }
        catch (Exception e)
        {
            assertEquals("Wrong Exception thrown: " + e.getClass().getName(), e.getClass(), UnknownEntityException.class);
View Full Code Here

      throws Exception
    {
        SecurityService ss = TurbineSecurity.getService();
        UserManager um = ss.getUserManager();

        User admin = um.retrieve("admin", "admin");

        try
        {
            admin = um.retrieve("admin", "no such password");
            fail("User was authenticated with wrong password");
View Full Code Here

      throws Exception
    {
        SecurityService ss = TurbineSecurity.getService();
        UserManager um = ss.getUserManager();

        User admin = um.retrieve("admin");
        um.store(admin);

        try
        {
            User newbie = TurbineSecurity.getUserInstance();
            newbie.setName("newbie");

            um.store(newbie);
            fail("Non Existing User could be stored!");
        }
        catch (Exception e)
View Full Code Here

      throws Exception
    {
        SecurityService ss = TurbineSecurity.getService();
        UserManager um = ss.getUserManager();

        User admin = um.retrieve("admin");

        um.authenticate(admin, "admin");

        try
        {
            User newbie = TurbineSecurity.getUserInstance();
            newbie.setName("newbie");

            um.authenticate(newbie, "somePw");
            fail("User was authenticated with wrong password");
        }
        catch (Exception e)
View Full Code Here

            // Pre-allocate a list which won't need expansion more
            // than once.
            users = new ArrayList((int) (activeSessions.size() * 0.7));
            for (Iterator i = activeSessions.values().iterator(); i.hasNext();)
            {
                User u = getUserFromSession((HttpSession) i.next());
                if (u != null && u.hasLoggedIn())
                {
                    users.add(u);
                }
            }
        }
View Full Code Here

      throws Exception
    {
        SecurityService ss = TurbineSecurity.getService();
        UserManager um = ss.getUserManager();

        User admin = um.retrieveById(new Integer(1));

        try
        {
            User doesNotExist = um.retrieveById(new Integer(667));
            fail("Non existing Account was retrieved");
        }
        catch (Exception e)
        {
            assertEquals("Wrong Exception thrown: " + e.getClass().getName(), e.getClass(), UnknownEntityException.class);
View Full Code Here

        synchronized (activeSessions)
        {
            for (Iterator i = activeSessions.values().iterator(); i.hasNext();)
            {
                HttpSession session = (HttpSession) i.next();
                User u = this.getUserFromSession(session);
                if (user.equals(u))
                {
                    sessions.add(session);
                }
            }
View Full Code Here

TOP

Related Classes of org.apache.turbine.om.security.User

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.