153 } 154 } 155 156 /** 157 * Wraps the outgoing buffer. 158 * 159 * @throws SaslException Not applicable to this mechanism. 160 */ 161 public byte[] wrap(byte[] outgoing, int offset, int len) throws SaslException { 162 if (completed) { 163 throw new SaslException( 164 "PLAIN supports neither integrity nor privacy"); 165 } else { 166 throw new IllegalStateException("PLAIN authentication not completed"); 167 } 168 } 169 170 /** 171 * Retrieves the negotiated property. 172 * This method can be called only after the authentication exchange has 173 * completed (i.e., when <tt>isComplete()</tt> returns true); otherwise, a 174 * <tt>SaslException</tt> is thrown. 175 * 176 * @return value of property; only QOP is applicable to PLAIN. 177 * @exception IllegalStateException if this authentication exchange 178 * has not completed 179 */ 180 public Object getNegotiatedProperty(String propName) { 181 if (completed) { 182 if (propName.equals(Sasl.QOP)) { 183 return "auth"; 184 } else { 185 return null; 186 } 187 } else { 188 throw new IllegalStateException("PLAIN authentication not completed"); 189 } 190 } 191 192 private void clearPassword() { 193 if (pw != null) { 194 // zero out password | 153 } 154 } 155 156 /** 157 * Wraps the outgoing buffer. 158 * 159 * @throws SaslException Not applicable to this mechanism. 160 */ 161 public byte[] wrap(byte[] outgoing, int offset, int len) throws SaslException { 162 if (completed) { 163 throw new SaslException( 164 "PLAIN supports neither integrity nor privacy"); 165 } else { 166 throw new IllegalStateException("PLAIN authentication not completed"); 167 } 168 } 169 170 /** 171 * Retrieves the negotiated property. 172 * This method can be called only after the authentication exchange has 173 * completed (i.e., when {@code isComplete()} returns true); otherwise, a 174 * {@code SaslException} is thrown. 175 * 176 * @return value of property; only QOP is applicable to PLAIN. 177 * @exception IllegalStateException if this authentication exchange 178 * has not completed 179 */ 180 public Object getNegotiatedProperty(String propName) { 181 if (completed) { 182 if (propName.equals(Sasl.QOP)) { 183 return "auth"; 184 } else { 185 return null; 186 } 187 } else { 188 throw new IllegalStateException("PLAIN authentication not completed"); 189 } 190 } 191 192 private void clearPassword() { 193 if (pw != null) { 194 // zero out password |