3 import javax.security.auth.callback.*;
6 public class GenericServer extends GenericCommon implements SaslServer
9 private byte[]initial_response;
10 private String mechanism;
11 private javax.security.auth.callback.CallbackHandler cbh;
12 private boolean started = false;
15 private native byte[] jni_sasl_server_start(int ptr,
16 String mech, byte[]in, int inlen);
18 private native byte[] jni_sasl_server_step(int ptr,
22 GenericServer(int cptr, String mechanism,
23 java.util.Hashtable props,
24 javax.security.auth.callback.CallbackHandler cbh)
28 this.mechanism = mechanism;
33 super.setcommonproperties(props);
37 public byte[] evaluateResponse(byte[] response) throws SaslException
49 inlen = response.length;
52 if (started == false) {
53 out=jni_sasl_server_start(ptr, mechanism,in,inlen);
56 out=jni_sasl_server_step(ptr,in,inlen);
62 public String getMechanismName()
67 public InputStream getInputStream(InputStream source) throws IOException
69 if (getSecurity() > 0) {
70 return new SaslInputStream(source,this);
72 // no security layer, no indirection needed
77 public OutputStream getOutputStream(OutputStream dest) throws IOException
79 if (getSecurity() > 0) {
80 return new SaslOutputStream(dest,this);
82 // no security layer, no indirection needed