001 /*
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements. See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership. The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the
007 * "License"); you may not use this file except in compliance
008 * with the License. You may obtain a copy of the License at
009 *
010 * http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing,
013 * software distributed under the License is distributed on an
014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015 * KIND, either express or implied. See the License for the
016 * specific language governing permissions and limitations
017 * under the License.
018 *
019 */
020 package org.apache.directory.server.kerberos.shared.replay;
021
022
023 import javax.security.auth.kerberos.KerberosPrincipal;
024
025 import org.apache.directory.server.kerberos.shared.messages.value.KerberosTime;
026
027
028 /**
029 * "The replay cache will store at least the server name, along with the client name,
030 * time, and microsecond fields from the recently-seen authenticators, and if a
031 * matching tuple is found, the KRB_AP_ERR_REPEAT error is returned."
032 *
033 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
034 * @version $Rev: 589775 $, $Date: 2007-10-29 20:04:59 +0200 (Mon, 29 Oct 2007) $
035 */
036 public interface ReplayCache
037 {
038 /**
039 * Returns whether a request is a replay, based on the server principal, client
040 * principal, time, and microseconds.
041 *
042 * @param serverPrincipal The server principal
043 * @param clientPrincipal The client principal
044 * @param clientTime The client time
045 * @param clientMicroSeconds The client microsecond
046 * @return true if the request is a replay.
047 */
048 boolean isReplay( KerberosPrincipal serverPrincipal, KerberosPrincipal clientPrincipal, KerberosTime clientTime,
049 int clientMicroSeconds );
050
051
052 /**
053 * Saves the server principal, client principal, time, and microseconds to
054 * the replay cache.
055 *
056 * @param serverPrincipal The server principal
057 * @param clientPrincipal The client principal
058 * @param clientTime The client time
059 * @param clientMicroSeconds The client microsecond
060 */
061 void save( KerberosPrincipal serverPrincipal, KerberosPrincipal clientPrincipal, KerberosTime clientTime,
062 int clientMicroSeconds );
063 }