| | |
| | | package com.gitblit.transport.ssh; |
| | | |
| | | import java.text.MessageFormat; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import java.util.concurrent.ExecutionException; |
| | | import java.util.concurrent.TimeUnit; |
| | |
| | | .build(new CacheLoader<String, List<SshKey>>() { |
| | | @Override |
| | | public List<SshKey> load(String username) { |
| | | return getKeysImpl(username); |
| | | List<SshKey> keys = getKeysImpl(username); |
| | | if (keys == null) { |
| | | return Collections.emptyList(); |
| | | } |
| | | return Collections.unmodifiableList(keys); |
| | | } |
| | | }); |
| | | |
| | |
| | | return null; |
| | | } |
| | | |
| | | public final void renameUser(String oldName, String newName) { |
| | | List<SshKey> keys = getKeys(oldName); |
| | | if (keys == null || keys.isEmpty()) { |
| | | return; |
| | | } |
| | | removeAllKeys(oldName); |
| | | for (SshKey key : keys) { |
| | | addKey(newName, key); |
| | | } |
| | | } |
| | | |
| | | protected abstract boolean isStale(String username); |
| | | |
| | | protected abstract List<SshKey> getKeysImpl(String username); |