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.messages; 021 022 023 import org.apache.directory.server.kerberos.shared.KerberosMessageType; 024 import org.apache.directory.server.kerberos.shared.messages.components.Ticket; 025 import org.apache.directory.server.kerberos.shared.messages.value.ApOptions; 026 import org.apache.directory.server.kerberos.shared.messages.value.EncryptedData; 027 028 029 /** 030 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a> 031 * @version $Rev: 589780 $, $Date: 2007-10-29 19:14:59 +0100 (Mon, 29 Oct 2007) $ 032 */ 033 public class ApplicationRequest extends KerberosMessage 034 { 035 private ApOptions apOptions; 036 private Ticket ticket; 037 private EncryptedData encPart; // Authenticator 038 039 040 /** 041 * Creates a new instance of ApplicationRequest. 042 */ 043 public ApplicationRequest() 044 { 045 super( KerberosMessageType.AP_REQ ); 046 // used by ASN1 decoder 047 } 048 049 050 /** 051 * Creates a new instance of ApplicationRequest. 052 * 053 * @param apOptions 054 * @param ticket 055 * @param encPart 056 */ 057 public ApplicationRequest( ApOptions apOptions, Ticket ticket, EncryptedData encPart ) 058 { 059 super( KerberosMessageType.AP_REQ ); 060 this.apOptions = apOptions; 061 this.ticket = ticket; 062 this.encPart = encPart; 063 } 064 065 066 /** 067 * Returns the {@link ApOptions}. 068 * 069 * @return The {@link ApOptions}. 070 */ 071 public ApOptions getApOptions() 072 { 073 return apOptions; 074 } 075 076 077 /** 078 * Returns the {@link Ticket}. 079 * 080 * @return The {@link Ticket}. 081 */ 082 public Ticket getTicket() 083 { 084 return ticket; 085 } 086 087 088 /** 089 * Returns the option at a specified index. 090 * 091 * @param option 092 * @return The option. 093 */ 094 public boolean getOption( int option ) 095 { 096 return apOptions.get( option ); 097 } 098 099 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 }