Line data Source code
1 : // Copyright (C) 2010 The Android Open Source Project 2 : // 3 : // Licensed under the Apache License, Version 2.0 (the "License"); 4 : // you may not use this file except in compliance with the License. 5 : // You may obtain a copy of the License at 6 : // 7 : // http://www.apache.org/licenses/LICENSE-2.0 8 : // 9 : // Unless required by applicable law or agreed to in writing, software 10 : // distributed under the License is distributed on an "AS IS" BASIS, 11 : // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 : // See the License for the specific language governing permissions and 13 : // limitations under the License. 14 : 15 : package com.google.gerrit.server.ssh; 16 : 17 : import com.google.gerrit.entities.Account; 18 : import com.google.gerrit.exceptions.InvalidSshKeyException; 19 : import com.google.gerrit.server.account.AccountSshKey; 20 : import com.google.inject.AbstractModule; 21 : import com.google.inject.Module; 22 : import com.google.inject.Singleton; 23 : 24 : @Singleton 25 140 : public class NoSshKeyCache implements SshKeyCache, SshKeyCreator { 26 : 27 : public static Module module() { 28 141 : return new AbstractModule() { 29 : @Override 30 : protected void configure() { 31 141 : bind(SshKeyCache.class).to(NoSshKeyCache.class); 32 141 : bind(SshKeyCreator.class).to(NoSshKeyCache.class); 33 141 : } 34 : }; 35 : } 36 : 37 : @Override 38 16 : public void evict(String username) {} 39 : 40 : @Override 41 : public AccountSshKey create(Account.Id accountId, int seq, String encoded) 42 : throws InvalidSshKeyException { 43 0 : throw new InvalidSshKeyException(); 44 : } 45 : }