Package org.apache.turbine.om.security

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


    public boolean accountExists(String username)
            throws DataBackendException
    {
        try
        {
            User ldapUser = retrieve(username);
        }
        catch (UnknownEntityException ex)
        {
            return false;
        }
View Full Code Here


     */
    public User retrieve(String username, String password)
            throws PasswordMismatchException,
            UnknownEntityException, DataBackendException
    {
        User user = retrieve(username);

        authenticate(user, password);
        return user;
    }
View Full Code Here

            throws DataBackendException, UnknownEntityException
    {
        for (Iterator it = getUserList(new Criteria()).iterator();
             it.hasNext();)
        {
            User user = (User) it.next();
            for (Iterator rolesIterator = getRoles(user, group).iterator();
                 rolesIterator.hasNext();)
            {
                Role role = (Role) rolesIterator.next();
                revoke(user, group, role);
View Full Code Here

        //
        // Wrap the returned Objects into TorqueUsers.
        //
        for (Iterator it = list.iterator(); it.hasNext(); )
        {
            User u = getNewUser((Persistent) it.next());
            newList.add(u);
        }

        return newList;
    }
View Full Code Here

     *
     */

    public static User getNewUser(Persistent p)
    {
        User u = null;
        try
        {
            Class userWrapperClass = TurbineSecurity.getUserClass();

            Class [] clazz = new Class [] { Persistent.class };
View Full Code Here

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

        User newbie = um.retrieve("newbie");
        assertNotNull(newbie);

        um.removeAccount(newbie);

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

            um.removeAccount(foo);
            fail("Non Existing User could be deleted!");
        }
        catch (Exception e)
View Full Code Here

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

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

        um.changePassword(admin, admin.getPassword(), "foobar");

        User admin2 = um.retrieve("admin");
        assertEquals("Password was not changed!", "foobar", admin2.getPassword());

        try
        {
            admin = um.retrieve("admin");
            um.changePassword(admin, "admin", "foobar");
            fail("Password could be changed without old password!");
        }
        catch (Exception e)
        {
            assertEquals("Wrong Exception thrown: " + e.getClass().getName(), e.getClass(), PasswordMismatchException.class);
        }

        admin2 = um.retrieve("admin");
        assertEquals("Password was changed!", "foobar", admin2.getPassword());

        checkUserList();
    }
View Full Code Here

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

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

        um.forcePassword(admin, "barbaz");

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

        um.forcePassword(admin, "admin");

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


        checkUserList();
    }
View Full Code Here

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

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

        AccessControlList acl = ss.getACL(admin);
        assertNotNull(acl);
View Full Code Here

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

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

        AccessControlList acl = ss.getACL(admin);
        assertNotNull(acl);
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.