override def handle()

in thriftserver/server/src/main/scala/org/apache/livy/thriftserver/auth/AuthBridgeServer.scala [167:201]


  override def handle(callbacks: Array[Callback]): Unit = {
    var nc: NameCallback = null
    var pc: PasswordCallback = null
    callbacks.foreach {
      case ac: AuthorizeCallback =>
        val authid: String = ac.getAuthenticationID
        val authzid: String = ac.getAuthorizationID
        if (authid == authzid) {
          ac.setAuthorized(true)
        } else {
          ac.setAuthorized(false)
        }
        if (ac.isAuthorized) {
          if (logger.isDebugEnabled) {
            val username = SaslRpcServer.getIdentifier(authzid, secretManager).getUser.getUserName
            debug(s"SASL server DIGEST-MD5 callback: setting canonicalized client ID: $username")
          }
          ac.setAuthorizedID(authzid)
        }
      case c: NameCallback => nc = c
      case c: PasswordCallback => pc = c
      case _: RealmCallback => // Do nothing.
      case other =>
        throw new UnsupportedCallbackException(other, "Unrecognized SASL DIGEST-MD5 Callback")
    }
    if (pc != null) {
      val tokenIdentifier = SaslRpcServer.getIdentifier(nc.getDefaultName, secretManager)
      val password: Array[Char] = getPassword(tokenIdentifier)
      if (logger.isDebugEnabled) {
        debug("SASL server DIGEST-MD5 callback: setting password for client: " +
          tokenIdentifier.getUser)
      }
      pc.setPassword(password)
    }
  }