Search in sources :

Example 1 with NullKeyManager

use of com.gitblit.transport.ssh.NullKeyManager in project gitblit by gitblit.

the class IPublicKeyManagerProvider method get.

@Override
public synchronized IPublicKeyManager get() {
    if (manager != null) {
        return manager;
    }
    IStoredSettings settings = runtimeManager.getSettings();
    String clazz = settings.getString(Keys.git.sshKeysManager, FileKeyManager.class.getName());
    if (StringUtils.isEmpty(clazz)) {
        clazz = FileKeyManager.class.getName();
    }
    try {
        Class<? extends IPublicKeyManager> mgrClass = (Class<? extends IPublicKeyManager>) Class.forName(clazz);
        manager = runtimeManager.getInjector().getInstance(mgrClass);
    } catch (Exception e) {
        logger.error("failed to create public key manager", e);
        manager = new NullKeyManager();
    }
    return manager;
}
Also used : NullKeyManager(com.gitblit.transport.ssh.NullKeyManager) IStoredSettings(com.gitblit.IStoredSettings) FileKeyManager(com.gitblit.transport.ssh.FileKeyManager) IPublicKeyManager(com.gitblit.transport.ssh.IPublicKeyManager)

Aggregations

IStoredSettings (com.gitblit.IStoredSettings)1 FileKeyManager (com.gitblit.transport.ssh.FileKeyManager)1 IPublicKeyManager (com.gitblit.transport.ssh.IPublicKeyManager)1 NullKeyManager (com.gitblit.transport.ssh.NullKeyManager)1