View Javadoc

1   /*
2    *  Licensed to the Apache Software Foundation (ASF) under one
3    *  or more contributor license agreements.  See the NOTICE file
4    *  distributed with this work for additional information
5    *  regarding copyright ownership.  The ASF licenses this file
6    *  to you under the Apache License, Version 2.0 (the
7    *  "License"); you may not use this file except in compliance
8    *  with the License.  You may obtain a copy of the License at
9    *  
10   *    http://www.apache.org/licenses/LICENSE-2.0
11   *  
12   *  Unless required by applicable law or agreed to in writing,
13   *  software distributed under the License is distributed on an
14   *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   *  KIND, either express or implied.  See the License for the
16   *  specific language governing permissions and limitations
17   *  under the License. 
18   *  
19   */
20  package org.apache.directory.server.kerberos.shared.replay;
21  
22  
23  import javax.security.auth.kerberos.KerberosPrincipal;
24  
25  import org.apache.directory.server.kerberos.shared.messages.value.KerberosTime;
26  
27  
28  /**
29   * "The replay cache will store at least the server name, along with the client name,
30   * time, and microsecond fields from the recently-seen authenticators, and if a
31   * matching tuple is found, the KRB_AP_ERR_REPEAT error is returned."
32   * 
33   * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
34   * @version $Rev: 589775 $, $Date: 2007-10-29 19:04:59 +0100 (Mo, 29 Okt 2007) $
35   */
36  public interface ReplayCache
37  {
38      /**
39       * Returns whether a request is a replay, based on the server principal, client
40       * principal, time, and microseconds.
41       * 
42       * @param serverPrincipal The server principal 
43       * @param clientPrincipal The client principal
44       * @param clientTime The client time
45       * @param clientMicroSeconds The client microsecond
46       * @return true if the request is a replay.
47       */
48      boolean isReplay( KerberosPrincipal serverPrincipal, KerberosPrincipal clientPrincipal, KerberosTime clientTime,
49          int clientMicroSeconds );
50  
51  
52      /**
53       * Saves the server principal, client principal, time, and microseconds to
54       * the replay cache.
55       *
56       * @param serverPrincipal The server principal 
57       * @param clientPrincipal The client principal
58       * @param clientTime The client time
59       * @param clientMicroSeconds The client microsecond
60       */
61      void save( KerberosPrincipal serverPrincipal, KerberosPrincipal clientPrincipal, KerberosTime clientTime,
62          int clientMicroSeconds );
63  }