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;
}
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);
}
}
Aggregations