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.messages;
21  
22  
23  import org.apache.directory.server.kerberos.shared.KerberosMessageType;
24  import org.apache.directory.server.kerberos.shared.messages.components.Ticket;
25  import org.apache.directory.server.kerberos.shared.messages.value.ApOptions;
26  import org.apache.directory.server.kerberos.shared.messages.value.EncryptedData;
27  
28  
29  /**
30   * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
31   * @version $Rev: 589780 $, $Date: 2007-10-29 19:14:59 +0100 (Mo, 29 Okt 2007) $
32   */
33  public class ApplicationRequest extends KerberosMessage
34  {
35      private ApOptions apOptions;
36      private Ticket ticket;
37      private EncryptedData encPart; // Authenticator
38  
39  
40      /**
41       * Creates a new instance of ApplicationRequest.
42       */
43      public ApplicationRequest()
44      {
45          super( KerberosMessageType.AP_REQ );
46          // used by ASN1 decoder
47      }
48  
49  
50      /**
51       * Creates a new instance of ApplicationRequest.
52       *
53       * @param apOptions
54       * @param ticket
55       * @param encPart
56       */
57      public ApplicationRequest( ApOptions apOptions, Ticket ticket, EncryptedData encPart )
58      {
59          super( KerberosMessageType.AP_REQ );
60          this.apOptions = apOptions;
61          this.ticket = ticket;
62          this.encPart = encPart;
63      }
64  
65  
66      /**
67       * Returns the {@link ApOptions}.
68       *
69       * @return The {@link ApOptions}.
70       */
71      public ApOptions getApOptions()
72      {
73          return apOptions;
74      }
75  
76  
77      /**
78       * Returns the {@link Ticket}.
79       *
80       * @return The {@link Ticket}.
81       */
82      public Ticket getTicket()
83      {
84          return ticket;
85      }
86  
87  
88      /**
89       * Returns the option at a specified index.
90       *
91       * @param option
92       * @return The option.
93       */
94      public boolean getOption( int option )
95      {
96          return apOptions.get( option );
97      }
98  
99  
100     /**
101      * Sets the option at a specified index.
102      *
103      * @param option
104      */
105     public void setOption( int option )
106     {
107         apOptions.set( option );
108     }
109 
110 
111     /**
112      * Clears the option at a specified index.
113      *
114      * @param option
115      */
116     public void clearOption( int option )
117     {
118         apOptions.clear( option );
119     }
120 
121 
122     /**
123      * Returns the {@link EncryptedData}.
124      *
125      * @return The {@link EncryptedData}.
126      */
127     public EncryptedData getEncPart()
128     {
129         return encPart;
130     }
131 
132 
133     /**
134      * Sets the {@link EncryptedData}.
135      *
136      * @param data
137      */
138     public void setEncPart( EncryptedData data )
139     {
140         encPart = data;
141     }
142 
143 
144     /**
145      * Sets the {@link ApOptions}.
146      *
147      * @param options
148      */
149     public void setApOptions( ApOptions options )
150     {
151         apOptions = options;
152     }
153 
154 
155     /**
156      * Sets the {@link Ticket}.
157      *
158      * @param ticket
159      */
160     public void setTicket( Ticket ticket )
161     {
162         this.ticket = ticket;
163     }
164 }