Package org.apache.lenya.ac

Examples of org.apache.lenya.ac.User


        if (session != null) {
            Identity identity = (Identity) session.getAttribute(Identity.class.getName());
            if (identity != null) {
                if (name.equals(USER_ID)) {
                    User user = identity.getUser();
                    if (user != null) {
                        value = user.getId();
                    }
                } else if (name.equals(USER_NAME)) {
                    User user = identity.getUser();
                    if (user != null) {
                        value = user.getName();
                    }
                } else if (name.equals(USER_EMAIL)) {
                    User user = identity.getUser();
                    if (user != null) {
                        value = user.getEmail();
                    }
                } else if (name.equals(IP_ADDRESS)) {
                    Machine machine = identity.getMachine();
                    if (machine != null) {
                        value = machine.getIp();
View Full Code Here


                    "Authenticating username [" + username + "]");
        }

        Identity identity = (Identity) request.getSession(false).getAttribute(Identity.class.getName());

        User user = accreditableManager.getUserManager().getUser(username);

        boolean authenticated = false;
        if (user != null) {
            if (getLogger().isDebugEnabled()) {
                getLogger().debug("User [" + user + "] authenticated.");
            }

            if (!identity.contains(user)) {
                User oldUser = identity.getUser();
                if (oldUser != null) {
                    if (getLogger().isDebugEnabled()) {
                        getLogger().debug("Removing user [" + oldUser + "] from identity.");
                    }
                    identity.removeIdentifiable(oldUser);
View Full Code Here

     * @throws AccessControlException if an error occurs
     */
    final public void testGetEmail() throws AccessControlException {
        String userID = "alice";
        String email = "alice@wonderland.org";
        User user = createAndSaveUser(userID, "Alice Wonderland", email, "secret");
        assertTrue(user.getEmail().equals(email));
        user = loadUser(userID);
        assertTrue(user.getEmail().equals(email));
    }
View Full Code Here

        File configDir = getAccreditablesDirectory();
        UserType[] userTypes = { FileAccreditableManager.getDefaultUserType() };
        FileUserManager manager = FileUserManager.instance(configDir, userTypes);
        assertNotNull(manager);

        User lenya = manager.getUser("lenya");
        assertNotNull(lenya);
        assertTrue(lenya.authenticate("levi"));
    }
View Full Code Here

        String adminRoleId = "adminRole";

        FileRole editorRole = new FileRole(configDir, editorRoleId);
        FileRole adminRole = new FileRole(configDir, adminRoleId);

        User user =
            new FileUser(configDir, userName, "Alice in Wonderland", "alice@test.com", "secret");

        editorRole.save();
        adminRole.save();

        Group editorGroup = new FileGroup(configDir, editorGroupId);

        //    editorGroup.addRole(editorRole);
        editorGroup.add(user);

        FileGroup adminGroup = new FileGroup(configDir, adminGroupId);

        //    adminGroup.addRole(editorRole);
        //    adminGroup.addRole(adminRole);
        editorGroup.save();
        adminGroup.save();
        adminGroup.add(user);
        user.save();

        FileGroupManager groupManager = null;
        UserType[] userTypes = { FileAccreditableManager.getDefaultUserType() };
        FileUserManager userManager = FileUserManager.instance(configDir, userTypes);
        assertNotNull(userManager);
View Full Code Here

        UserType[] userTypes = { FileAccreditableManager.getDefaultUserType() };
        FileUserManager manager = FileUserManager.instance(configDir, userTypes);
        assertNotNull(manager);
        manager.add(user);

        User otherUser = manager.getUser(userName);
        assertEquals(user, otherUser);
        assertEquals(user.getDescription(), otherUser.getDescription());
        assertEquals(user.getEmail(), otherUser.getEmail());
        assertEquals(user.getEncryptedPassword(), ((AbstractUser) otherUser).getEncryptedPassword());
    }
View Full Code Here

     *
     * @throws AccessControlException if an error occurs
     */
    public void testIdentity() throws AccessControlException {
        Identity identity = new Identity();
        User user = getAccessController().getAccreditableManager().getUserManager().getUser(USER_ID);
        System.out.println("Adding user to identity: [" + user + "]");
        identity.addIdentifiable(user);
       
        assertSame(user, identity.getUser());
    }
View Full Code Here

    final public void testSave()
        throws ConfigurationException, AccessControlException {
        String userName = "felix";
        createAndSaveUser(userName, "felix@wyona.com", "m400032");

        User user = null;
        user = loadUser(userName);
        assertNotNull(user);
    }
View Full Code Here

        Identity identity = (Identity) session.getAttribute(Identity.class.getName());

        String userId = "";
        String ipAddress = "";

        User user = identity.getUser();
        if (user != null) {
            userId = user.getId();
        }

        Machine machine = identity.getMachine();
        if (machine != null) {
            ipAddress = machine.getIp();
View Full Code Here

      log.debug("    No notification parameters found.");
    } else {
      log.debug("    Initializing notification");
           
            Identity identity = Identity.getIdentity(request.getSession());
            User user = identity.getUser();
            String eMail = user.getEmail();
            notificationMap.put(Notifier.PARAMETER_FROM, eMail);
            log.debug("    Setting from address [" + Notifier.PARAMETER_FROM + "] = [" + eMail + "]");

      String toKey = NamespaceMap.getFullName(Notifier.PREFIX, Notifier.PARAMETER_TO);
      String[] toValues = request.getParameterValues(toKey);
View Full Code Here

TOP

Related Classes of org.apache.lenya.ac.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.