//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public void setUserPassword(String username, byte[] password, boolean requirePasswordChange) throws java.io.IOException, org.neo4j.kernel.api.exceptions.InvalidArgumentsException public override void SetUserPassword(string username, sbyte[] password, bool requirePasswordChange) { try { User existingUser = GetUser(username); PasswordPolicy.validatePassword(password); if (existingUser.Credentials().matchesPassword(password)) { throw new InvalidArgumentsException("Old password and new password cannot be the same."); } try { User updatedUser = existingUser.Augment().withCredentials(LegacyCredential.forPassword(password)).withRequiredPasswordChange(requirePasswordChange).build(); UserRepository.update(existingUser, updatedUser); } catch (ConcurrentModificationException) { // try again SetUserPassword(username, password, requirePasswordChange); } } finally { // Clear password if (password != null) { Arrays.fill(password, ( sbyte )0); } } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public org.neo4j.kernel.impl.security.User newUser(String username, byte[] initialPassword, boolean requirePasswordChange) throws java.io.IOException, org.neo4j.kernel.api.exceptions.InvalidArgumentsException public override User NewUser(string username, sbyte[] initialPassword, bool requirePasswordChange) { try { UserRepository.assertValidUsername(username); PasswordPolicy.validatePassword(initialPassword); User user = (new User.Builder()).withName(username).withCredentials(LegacyCredential.forPassword(initialPassword)).withRequiredPasswordChange(requirePasswordChange).build(); UserRepository.create(user); return(user); } finally { // Clear password if (initialPassword != null) { Arrays.fill(initialPassword, ( sbyte )0); } } }