Codota Logo
Sasl
Code IndexAdd Codota to your IDE (free)

How to use
Sasl
in
javax.security.sasl

Best Java code snippets using javax.security.sasl.Sasl (Showing top 20 results out of 900)

Refine searchRefine arrow

  • SaslClient
  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
LocalDateTime l =
  • Codota Iconnew LocalDateTime()
  • Codota IconLocalDateTime.now()
  • Codota IconDateTimeFormatter formatter;String text;formatter.parseLocalDateTime(text)
  • Smart code suggestions by Codota
}
origin: apache/hbase

protected SaslClient createDigestSaslClient(String[] mechanismNames, String saslDefaultRealm,
  CallbackHandler saslClientCallbackHandler) throws IOException {
 return Sasl.createSaslClient(mechanismNames, null, null, saslDefaultRealm, saslProps,
  saslClientCallbackHandler);
}
origin: apache/avro

 public SaslServer getServer() throws SaslException {
  return Sasl.createSaslServer(mechanism, protocol, serverName,
                props, cbh);
 }
});
origin: org.apache.hadoop/hadoop-common

FastSaslServerFactory(Map<String,?> props) {
 final Enumeration<SaslServerFactory> factories =
   Sasl.getSaslServerFactories();
 while (factories.hasMoreElements()) {
  SaslServerFactory factory = factories.nextElement();
  for (String mech : factory.getMechanismNames(props)) {
   if (!factoryCache.containsKey(mech)) {
    factoryCache.put(mech, new ArrayList<SaslServerFactory>());
   }
   factoryCache.get(mech).add(factory);
  }
 }
}
origin: camunda/camunda-bpm-platform

  @SuppressWarnings("unchecked")
  Map<String, ?> propsMap = (Map) props;
  sc = Sasl.createSaslClient(mechs, authzid, name, host,
        propsMap, cbh);
} catch (SaslException sex) {
  logger.fine("SASL client " + sc.getMechanismName());
  args.writeAtom(sc.getMechanismName());
  if (pr.hasCapability("SASL-IR") && sc.hasInitialResponse()) {
  String irs;
  byte[] ba = sc.evaluateChallenge(new byte[0]);
origin: org.apache.qpid/qpid-jms-client

  @Override
  public byte[] run() throws Exception {
    Map<String, String> props = new HashMap<>();
    props.put("javax.security.sasl.server.authentication", "true");
    saslClient = Sasl.createSaslClient(new String[]{NAME}, null, protocol, serverName, props, null);
    if (saslClient.hasInitialResponse()) {
      return saslClient.evaluateChallenge(new byte[0]);
    }
    return null;
  }
});
origin: com.axway.ats.gnu.classpath.ext/inetlib

p.put("gnu.crypto.sasl.password", password);
SaslClient sasl =
 Sasl.createSaslClient(m, null, "smtp",
             socket.getInetAddress().getHostName(),
             p, ch);
cmd.append(' ');
cmd.append(mechanism);
if (sasl.hasInitialResponse())
  byte[] init = sasl.evaluateChallenge(new byte[0]);
  cmd.append(new String(init, "US-ASCII"));
  String qop = (String) sasl.getNegotiatedProperty(Sasl.QOP);
  if ("auth-int".equalsIgnoreCase(qop)
    || "auth-conf".equalsIgnoreCase(qop))
origin: killme2008/xmemcached

private Command startAuth() throws SaslException {
 // destroy previous client.
 destroySaslClient();
 this.saslClient = Sasl.createSaslClient(authInfo.getMechanisms(), null, "memcached",
   memcachedTCPSession.getRemoteSocketAddress().toString(), null,
   this.authInfo.getCallbackHandler());
 byte[] response =
   saslClient.hasInitialResponse() ? saslClient.evaluateChallenge(EMPTY_BYTES) : EMPTY_BYTES;
 CountDownLatch latch = new CountDownLatch(1);
 Command command =
   this.commandFactory.createAuthStartCommand(saslClient.getMechanismName(), latch, response);
 if (!this.memcachedTCPSession.isClosed())
  this.memcachedTCPSession.write(command);
 else {
  log.error("Authentication fail,because the connection has been closed");
  throw new RuntimeException("Authentication fai,connection has been close");
 }
 return command;
}
origin: org.apache.kerby/kerb-admin

  String protocol = adminConfig.getProtocol();
  String serverName = adminConfig.getServerName();
  saslClient = Sasl.createSaslClient(new String[]{"GSSAPI"}, null,
    protocol, serverName, props, null);
} catch (SaslException e) {
  response = saslClient.hasInitialResponse()
    ? saslClient.evaluateChallenge(EMPTY) : EMPTY;
} catch (SaslException e) {
  LOG.error("Sasl client evaluate challenge failed." + e);
while (!saslClient.isComplete()) {
  int ssComplete = message.getInt();
  if (ssComplete == 0) {
origin: com.github.jiayuhan-it/hadoop-common

private void runNegotiation(CallbackHandler clientCbh,
              CallbackHandler serverCbh)
                throws SaslException {
 String mechanism = AuthMethod.PLAIN.getMechanismName();
 SaslClient saslClient = Sasl.createSaslClient(
   new String[]{ mechanism }, null, null, null, null, clientCbh);
 assertNotNull(saslClient);
 SaslServer saslServer = Sasl.createSaslServer(
   mechanism, null, "localhost", null, serverCbh);
 assertNotNull("failed to find PLAIN server", saslServer);
 
 byte[] response = saslClient.evaluateChallenge(new byte[0]);
 assertNotNull(response);
 assertTrue(saslClient.isComplete());
 response = saslServer.evaluateResponse(response);
 assertNull(response);
 assertTrue(saslServer.isComplete());
 assertNotNull(saslServer.getAuthorizationID());
}

origin: com.axway.ats.gnu.classpath.ext/inetlib

p.put("gnu.crypto.sasl.password", password);
SaslClient sasl =
 Sasl.createSaslClient(m, null, "pop3",
            socket.getInetAddress().getHostName(),
            p, ch);
    String qop = (String) sasl.getNegotiatedProperty(Sasl.QOP);
    if ("auth-int".equalsIgnoreCase(qop)
      || "auth-conf".equalsIgnoreCase(qop))
      byte[] r0 = sasl.evaluateChallenge(c1);
      byte[] r1 = BASE64.encode(r0);       // response
      out.write(r1);
origin: com.google.code.simple-spring-memcached/spymemcached

@Override
public void initialize() {
 try {
  SaslClient sc = Sasl.createSaslClient(mech, null, "memcached",
    serverName, props, cbh);
  byte[] response = buildResponse(sc);
  String mechanism = sc.getMechanismName();
  prepareBuffer(mechanism, 0, response);
 } catch (SaslException e) {
  // XXX: Probably something saner can be done here.
  throw new RuntimeException("Can't make SASL go.", e);
 }
}
origin: org.tmatesoft.svnkit/svnkit

private static SaslClientFactory getSaslClientFactory(String mechName, Map props) {
  if (mechName == null) {
    return null;
  }
  if ("ANONYMOUS".equals(mechName)) {
    mechName = "PLAIN";
  }
  for(Enumeration factories = Sasl.getSaslClientFactories(); factories.hasMoreElements();) {
    SaslClientFactory factory = (SaslClientFactory) factories.nextElement();
    String[] mechs = factory.getMechanismNames(props);
    for (int i = 0; mechs != null && i < mechs.length; i++) {
      if (mechName.endsWith(mechs[i])) {
        return factory; 
      }
    }
  }
  return null;
}
origin: com.sun.mail/javax.mail

  @SuppressWarnings("unchecked")
  Map<String, ?> propsMap = (Map) props;
  sc = Sasl.createSaslClient(mechs, authzid, name, host,
        propsMap, cbh);
} catch (SaslException sex) {
  logger.fine("SASL client " + sc.getMechanismName());
  args.writeAtom(sc.getMechanismName());
  if (pr.hasCapability("SASL-IR") && sc.hasInitialResponse()) {
  String irs;
  byte[] ba = sc.evaluateChallenge(new byte[0]);
origin: apache/qpid-jms

  @Override
  public byte[] run() throws Exception {
    Map<String, String> props = new HashMap<>();
    props.put("javax.security.sasl.server.authentication", "true");
    saslClient = Sasl.createSaslClient(new String[]{NAME}, null, protocol, serverName, props, null);
    if (saslClient.hasInitialResponse()) {
      return saslClient.evaluateChallenge(new byte[0]);
    }
    return null;
  }
});
origin: com.axway.ats.framework/ats-actionlibrary

p.put("gnu.crypto.sasl.username", username);
p.put("gnu.crypto.sasl.password", password);
SaslClient sasl = Sasl.createSaslClient(m,
                    null,
                    "smtp",
cmd.append(' ');
cmd.append(mechanism);
if (sasl.hasInitialResponse()) {
  cmd.append(' ');
  byte[] init = sasl.evaluateChallenge(new byte[0]);
  if (init.length == 0) {
    cmd.append('=');
        byte[] c0 = response.getBytes("US-ASCII");
        byte[] c1 = BASE64.decode(c0); // challenge
        byte[] r0 = sasl.evaluateChallenge(c1);
        byte[] r1 = BASE64.encode(r0); // response
        out.write(r1);
origin: com.googlecode.xmemcached/xmemcached

private Command startAuth() throws SaslException {
 // destroy previous client.
 destroySaslClient();
 this.saslClient = Sasl.createSaslClient(authInfo.getMechanisms(), null, "memcached",
   memcachedTCPSession.getRemoteSocketAddress().toString(), null,
   this.authInfo.getCallbackHandler());
 byte[] response =
   saslClient.hasInitialResponse() ? saslClient.evaluateChallenge(EMPTY_BYTES) : EMPTY_BYTES;
 CountDownLatch latch = new CountDownLatch(1);
 Command command =
   this.commandFactory.createAuthStartCommand(saslClient.getMechanismName(), latch, response);
 if (!this.memcachedTCPSession.isClosed())
  this.memcachedTCPSession.write(command);
 else {
  log.error("Authentication fail,because the connection has been closed");
  throw new RuntimeException("Authentication fai,connection has been close");
 }
 return command;
}
origin: apache/directory-kerby

  String protocol = adminConfig.getProtocol();
  String serverName = adminConfig.getServerName();
  saslClient = Sasl.createSaslClient(new String[]{"GSSAPI"}, null,
    protocol, serverName, props, null);
} catch (SaslException e) {
  response = saslClient.hasInitialResponse()
    ? saslClient.evaluateChallenge(EMPTY) : EMPTY;
} catch (SaslException e) {
  LOG.error("Sasl client evaluate challenge failed." + e);
while (!saslClient.isComplete()) {
  int ssComplete = message.getInt();
  if (ssComplete == 0) {
origin: ch.cern.hadoop/hadoop-common

private void runNegotiation(CallbackHandler clientCbh,
              CallbackHandler serverCbh)
                throws SaslException {
 String mechanism = AuthMethod.PLAIN.getMechanismName();
 SaslClient saslClient = Sasl.createSaslClient(
   new String[]{ mechanism }, null, null, null, null, clientCbh);
 assertNotNull(saslClient);
 SaslServer saslServer = Sasl.createSaslServer(
   mechanism, null, "localhost", null, serverCbh);
 assertNotNull("failed to find PLAIN server", saslServer);
 
 byte[] response = saslClient.evaluateChallenge(new byte[0]);
 assertNotNull(response);
 assertTrue(saslClient.isComplete());
 response = saslServer.evaluateResponse(response);
 assertNull(response);
 assertTrue(saslServer.isComplete());
 assertNotNull(saslServer.getAuthorizationID());
}

origin: com.axway.ats.gnu.classpath.ext/inetlib

p.put("gnu.crypto.sasl.username", username);
p.put("gnu.crypto.sasl.password", password);
SaslClient sasl = Sasl.createSaslClient(m, null, "imap",
                    socket.getInetAddress().
                    getHostName(), p, ch);
       (String) sasl.getNegotiatedProperty(Sasl.QOP);
      if ("auth-int".equalsIgnoreCase(qop)
        || "auth-conf".equalsIgnoreCase(qop))
      byte[] r0 = sasl.evaluateChallenge(c1);
      byte[] r1 = BASE64.encode(r0);       // response
      out.write(r1);
origin: com.google.code.maven-play-plugin.spy/spymemcached

@Override
public void initialize() {
  try {
    SaslClient sc=Sasl.createSaslClient(mech, null,
        "memcached", serverName, props, cbh);
    byte[] response = buildResponse(sc);
    String mechanism = sc.getMechanismName();
    prepareBuffer(mechanism, 0, response);
  } catch(SaslException e) {
    // XXX:  Probably something saner can be done here.
    throw new RuntimeException("Can't make SASL go.", e);
  }
}
javax.security.saslSasl

Most used methods

  • createSaslClient
  • createSaslServer
  • getSaslServerFactories
  • getSaslClientFactories

Popular in Java

  • Creating JSON documents from java classes using gson
  • putExtra (Intent)
  • addToBackStack (FragmentTransaction)
  • onCreateOptionsMenu (Activity)
  • Component (java.awt)
    A component is an object having a graphical representation that can be displayed on the screen and t
  • IOException (java.io)
    Signals that an I/O exception of some sort has occurred. This class is the general class of exceptio
  • URL (java.net)
    A Uniform Resource Locator that identifies the location of an Internet resource as specified by RFC
  • Time (java.sql)
    Java representation of an SQL TIME value. Provides utilities to format and parse the time's represen
  • Map (java.util)
    A Map is a data structure consisting of a set of keys and values in which each key is mapped to a si
  • JarFile (java.util.jar)
    JarFile is used to read jar entries and their associated data from jar files.
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now