James Moger
2013-11-20 bdfdc9c65c5eb2786b7dd8e33ba8a12a3bafe86d
src/main/java/com/gitblit/HtpasswdUserService.java
@@ -33,6 +33,7 @@
import org.slf4j.LoggerFactory;
import com.gitblit.Constants.AccountType;
import com.gitblit.manager.IRuntimeManager;
import com.gitblit.models.UserModel;
import com.gitblit.utils.ArrayUtils;
import com.gitblit.utils.StringUtils;
@@ -79,6 +80,7 @@
    private final boolean SUPPORT_PLAINTEXT_PWD;
    private IRuntimeManager runtimeManager;
    private IStoredSettings settings;
    private File htpasswdFile;
@@ -116,17 +118,18 @@
     * In addition the setup tries to read and parse the htpasswd file to be used
     * for authentication.
     *
     * @param settings
     * @since 0.7.0
     * @param runtimeManager
     * @since 1.4.0
     */
    @Override
    public void setup(IStoredSettings settings)
    public void setup(IRuntimeManager runtimeManager)
    {
        this.settings = settings;
       this.runtimeManager = runtimeManager;
        this.settings = runtimeManager.getSettings();
        // This is done in two steps in order to avoid calling GitBlit.getFileOrFolder(String, String) which will segfault for unit tests.
        String file = settings.getString(KEY_BACKING_US, DEFAULT_BACKING_US);
        File realmFile = GitBlit.getFileOrFolder(file);
        File realmFile = runtimeManager.getFileOrFolder(file);
        serviceImpl = createUserService(realmFile);
        logger.info("Htpasswd User Service backed by " + serviceImpl.toString());
@@ -291,7 +294,7 @@
        if ( !file.equals(htpasswdFilePath) ) {
            // The htpasswd file setting changed. Rediscover the file.
            this.htpasswdFilePath = file;
            this.htpasswdFile = GitBlit.getFileOrFolder(file);
            this.htpasswdFile = runtimeManager.getFileOrFolder(file);
            this.htUsers.clear();
            this.forceReload = true;
        }