Search in sources :

Example 1 with UserRepository

use of org.simbasecurity.core.domain.repository.UserRepository in project simba-os by cegeka.

the class ActiveDirectoryLoginModule method updateUserGroups.

private void updateUserGroups(LdapContext ldapContext, String userCN) {
    UserRepository userRepository = GlobalContext.locate(UserRepository.class);
    User user = userRepository.findByName(getUsername());
    if (user != null) {
        user.clearGroups();
        try {
            addADGroupsToUser(ldapContext, user, userCN);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
Also used : UserRepository(org.simbasecurity.core.domain.repository.UserRepository) User(org.simbasecurity.core.domain.User) LoginException(javax.security.auth.login.LoginException) NamingException(javax.naming.NamingException) FailedLoginException(javax.security.auth.login.FailedLoginException)

Aggregations

NamingException (javax.naming.NamingException)1 FailedLoginException (javax.security.auth.login.FailedLoginException)1 LoginException (javax.security.auth.login.LoginException)1 User (org.simbasecurity.core.domain.User)1 UserRepository (org.simbasecurity.core.domain.repository.UserRepository)1