Package com.adito.security

Examples of com.adito.security.UserDatabase


            String realmName = getBefore(realmAndUsername, "/");
            String username = realmName == null ? realmAndUsername : getAfter(realmAndUsername, "/");
            String password = getAfter(credentials, ":");

            try {
                UserDatabase userDatabase = getUserDatabase(realmName);
                if (userDatabase.checkPassword(username, password)) {
                    return userDatabase.getAccount(username);
                }
            } catch (InvalidLoginCredentialsException e) {
                logger.info("Authentication failed for user " + username);
            } catch (Exception e) {
                logger.error("An error occurred", e);
View Full Code Here


            client.login(helo);
        }
    }
   
    private void send(Message message, Recipient recipient) throws Exception {
        UserDatabase userDatabase = UserDatabaseManager.getInstance().getUserDatabase(recipient.getRealmName());
        User user = userDatabase.getAccount(recipient.getRecipientAlias());

        String sender = Property.getProperty(new SystemConfigKey("smtp.senderAddress"));
        client.setSender(sender);
        client.addRecipient(user.getEmail());
        Writer writer = client.sendMessageData();
View Full Code Here

        }
        return sender.getSentMessageCount();
    }

    private void sendByPolicy(MessageSender sender, Recipient recipient) throws Exception, UserDatabaseException {
        UserDatabase userDatabase = UserDatabaseManager.getInstance().getUserDatabase(recipient.getRealmName());
        PolicyDatabase policyDatabase = PolicyDatabaseFactory.getInstance();
        Realm realm = userDatabase.getRealm();
        Policy policy = policyDatabase.getPolicyByName(recipient.getRecipientAlias(), realm.getResourceId());
        int everyonePolicyId = policyDatabase.getEveryonePolicyIDForRealm(realm);
       
        if (everyonePolicyId == policy.getResourceId()) {
            sendToPrincipals(sender, userDatabase, userDatabase.allRoles());
            sendToPrincipals(sender, userDatabase, userDatabase.allUsers());
        } else {
            List<Principal> principals = policyDatabase.getPrincipalsGrantedPolicy(policy, realm);
            sendToPrincipals(sender, userDatabase, principals);
        }
    }
View Full Code Here

            }
        }
    }

    private void sendByRole(MessageSender sender, Recipient recipient) throws Exception, RoleNotFoundException, UserDatabaseException {
        UserDatabase userDatabase = UserDatabaseManager.getInstance().getUserDatabase(recipient.getRealmName());
        Role role = userDatabase.getRole(recipient.getRecipientAlias());
        sendByRole(sender, userDatabase, role);
    }
View Full Code Here

            sender.sendMessage(user.getPrincipalName(), newRecipient);
        }
    }
   
    private void sendByAdmin(MessageSender sender, Recipient recipient) throws Exception, UserDatabaseException {
        UserDatabase userDatabase = UserDatabaseManager.getInstance().getUserDatabase(recipient.getRealmName());
        for (User user : userDatabase.allUsers()) {
            if (LogonControllerFactory.getInstance().isAdministrator(user)) {
                Recipient newRecipient = new Recipient(Recipient.USER, user.getPrincipalName(), user.getRealm().getResourceName());
                sender.sendMessage(user.getPrincipalName(), newRecipient);
            }
        }
View Full Code Here

TOP

Related Classes of com.adito.security.UserDatabase

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.