James Moger
2015-11-22 ed552ba47c02779c270ffd62841d6d1048dade70
commit | author | age
b53611 1 /*
JM 2  * Copyright 2014 gitblit.com.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5  * use this file except in compliance with the License. You may obtain a copy of
6  * the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13  * License for the specific language governing permissions and limitations under
14  * the License.
15  */
16 package com.gitblit.transport.ssh;
17
18 import java.util.List;
19
241f57 20 import com.google.inject.Inject;
JM 21
b53611 22 /**
245836 23  * Rejects all public key management requests.
aaecd8 24  *
b53611 25  * @author James Moger
JM 26  *
27  */
245836 28 public class NullKeyManager extends IPublicKeyManager {
b53611 29
241f57 30     @Inject
b53611 31     public NullKeyManager() {
JM 32     }
aaecd8 33
b53611 34     @Override
JM 35     public String toString() {
36         return getClass().getSimpleName();
37     }
38
39     @Override
40     public NullKeyManager start() {
245836 41         log.info(toString());
b53611 42         return this;
JM 43     }
aaecd8 44
b53611 45     @Override
JM 46     public boolean isReady() {
47         return true;
48     }
aaecd8 49
b53611 50     @Override
JM 51     public NullKeyManager stop() {
52         return this;
53     }
54
55     @Override
aaecd8 56     protected boolean isStale(String username) {
JM 57         return false;
58     }
59
60     @Override
bcc8a0 61     protected List<SshKey> getKeysImpl(String username) {
b53611 62         return null;
JM 63     }
64
65     @Override
bcc8a0 66     public boolean addKey(String username, SshKey key) {
b53611 67         return false;
JM 68     }
aaecd8 69
b53611 70     @Override
bcc8a0 71     public boolean removeKey(String username, SshKey key) {
b53611 72         return false;
JM 73     }
5eafd9 74
DO 75     @Override
8ee7c8 76     public boolean removeAllKeys(String username) {
5eafd9 77         return false;
DO 78     }
b53611 79 }