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.kdc.authentication;
21  
22  
23  import org.apache.directory.server.kerberos.kdc.KdcContext;
24  import org.apache.directory.server.kerberos.shared.store.PrincipalStoreEntry;
25  import org.apache.directory.shared.kerberos.components.EncryptionKey;
26  import org.apache.directory.shared.kerberos.messages.Ticket;
27  
28  
29  /**
30   * A context used to store and manage Authentication elements
31   * 
32   * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
33   */
34  public class AuthenticationContext extends KdcContext
35  {
36      private static final long serialVersionUID = -2249170923251265359L;
37  
38      /** The Kerberos Ticket associated to this context */
39      private Ticket ticket;
40  
41      /** The client key */
42      private EncryptionKey clientKey;
43  
44      /** The client entry */
45      private PrincipalStoreEntry clientEntry;
46  
47      /** The server entry */
48      private PrincipalStoreEntry serverEntry;
49  
50      /** Tell if we have had a pre-authentication */
51      private boolean isPreAuthenticated;
52  
53  
54      /**
55       * @return Returns the serverEntry.
56       */
57      public PrincipalStoreEntry getServerEntry()
58      {
59          return serverEntry;
60      }
61  
62  
63      /**
64       * @param serverEntry The serverEntry to set.
65       */
66      public void setServerEntry( PrincipalStoreEntry serverEntry )
67      {
68          this.serverEntry = serverEntry;
69      }
70  
71  
72      /**
73       * @return Returns the clientEntry.
74       */
75      public PrincipalStoreEntry getClientEntry()
76      {
77          return clientEntry;
78      }
79  
80  
81      /**
82       * @param clientEntry The clientEntry to set.
83       */
84      public void setClientEntry( PrincipalStoreEntry clientEntry )
85      {
86          this.clientEntry = clientEntry;
87      }
88  
89  
90      /**
91       * @return Returns the checksumEngines.
92       *
93      public Map getChecksumEngines()
94      {
95          return checksumEngines;
96      }
97      */
98  
99      /**
100      * @param checksumEngines The checksumEngines to set.
101      *
102     public void setChecksumEngines( Map checksumEngines )
103     {
104         this.checksumEngines = checksumEngines;
105     }
106     */
107 
108     /**
109      * @return Returns the clientKey.
110      */
111     public EncryptionKey getClientKey()
112     {
113         return clientKey;
114     }
115 
116 
117     /**
118      * @param clientKey The clientKey to set.
119      */
120     public void setClientKey( EncryptionKey clientKey )
121     {
122         this.clientKey = clientKey;
123     }
124 
125 
126     /**
127      * @return Returns the ticket.
128      */
129     public Ticket getTicket()
130     {
131         return ticket;
132     }
133 
134 
135     /**
136      * @param ticket The ticket to set.
137      */
138     public void setTicket( Ticket ticket )
139     {
140         this.ticket = ticket;
141     }
142 
143 
144     /**
145      * @return true if the client used pre-authentication.
146      */
147     public boolean isPreAuthenticated()
148     {
149         return isPreAuthenticated;
150     }
151 
152 
153     /**
154      * @param isPreAuthenticated Whether the client used pre-authentication.
155      */
156     public void setPreAuthenticated( boolean isPreAuthenticated )
157     {
158         this.isPreAuthenticated = isPreAuthenticated;
159     }
160 
161 
162     /**
163      * @see Object#toString()
164      */
165     @Override
166     public String toString()
167     {
168         StringBuilder sb = new StringBuilder();
169 
170         sb.append( "AuthenticationContext \n" );
171         sb.append( super.toString() ).append( '\n' );
172         sb.append( "PreAuth : " ).append( isPreAuthenticated ).append( "\n" );
173         sb.append( "Client Entry : " ).append( clientEntry ).append( "\n" );
174 
175         return sb.toString();
176     }
177 }