Search in sources :

Example 1 with IPublicKeyManager

use of com.gitblit.transport.ssh.IPublicKeyManager 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)

Example 2 with IPublicKeyManager

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

the class KeysDispatcher method setup.

@Override
protected void setup() {
    IPublicKeyManager km = getContext().getGitblit().getPublicKeyManager();
    UserModel user = getContext().getClient().getUser();
    if (km != null && km.supportsWritingKeys(user)) {
        register(AddKey.class);
        register(RemoveKey.class);
    }
    register(ListKeys.class);
    register(WhichKey.class);
    if (km != null && km.supportsCommentChanges(user)) {
        register(CommentKey.class);
    }
    if (km != null && km.supportsPermissionChanges(user)) {
        register(PermissionKey.class);
    }
}
Also used : UserModel(com.gitblit.models.UserModel) IPublicKeyManager(com.gitblit.transport.ssh.IPublicKeyManager)

Aggregations

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