Project

General

Profile

« Previous | Next » 

Revision 49768

Update ldap createUser with password parameter

View differences:

modules/uoa-user-management/trunk/src/main/java/eu/dnetlib/openaire/user/utils/LDAPActions.java
45 45
        return null;
46 46
    }
47 47

  
48
    public Entry createUser(String username, String email, String firstName, String lastName, String institution/*, String password*/) throws Exception {
48
    public Entry createUser(String username, String email, String firstName, String lastName, String institution, String password) throws Exception {
49 49

  
50 50
        if(!username.matches("^[a-zA-Z0-9][a-zA-Z0-9_-]{4,150}")){
51 51
            throw new CustomLDAPException("Invalid username!");
......
84 84
            entry.addAttribute("o", institution);
85 85
        }
86 86
        ldapConnector.getConnection().add(entry);
87
//        PasswordModifyExtendedRequest passwordModifyExtendedRequest = new PasswordModifyExtendedRequest(entry.getDN(), (String) null, password);
88
//        PasswordModifyExtendedResult passwordModifyResult = (PasswordModifyExtendedResult) ldapConnector.getConnection().processExtendedOperation(passwordModifyExtendedRequest);
87
        PasswordModifyExtendedRequest passwordModifyExtendedRequest = new PasswordModifyExtendedRequest(entry.getDN(), (String) null, password);
88
        PasswordModifyExtendedResult passwordModifyResult = (PasswordModifyExtendedResult) ldapConnector.getConnection().processExtendedOperation(passwordModifyExtendedRequest);
89 89
        logger.info("User: " + username + " was created successfully!");
90 90

  
91 91
        return entry;

Also available in: Unified diff