Package org.apache.turbine.om.security

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


     *
     */

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

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


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

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

        Group global = ss.getGroupByName("global");
        assertNotNull(global);
View Full Code Here

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

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

        Group global = ss.getGroupByName("global");
        assertNotNull(global);
View Full Code Here

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

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

        Group turbine = ss.getGroupByName("Turbine");
        assertNotNull(turbine);
View Full Code Here

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

        User admin = ss.getAuthenticatedUser("admin", "admin");

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

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

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

        try
        {
            User newbie = ss.getUser("newbie");
            fail("Non Existing User could be loaded!");
        }
        catch (Exception e)
        {
            assertEquals("Wrong Exception thrown: " + e.getClass().getName(), e.getClass(), UnknownEntityException.class);
View Full Code Here

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

        User user = ss.getAnonymousUser();

        assertNotNull(user);

        assertTrue(ss.isAnonymousUser(user));
View Full Code Here

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

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

        ss.saveUser(admin);

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

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

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

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

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

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

        try
        {
            admin = ss.getUser("admin");
            ss.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 = ss.getUser("admin");
        assertEquals("Password was changed!", "foobar", admin2.getPassword());

        checkUserList();
    }
View Full Code Here

    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

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.