0

I am using this snippet to authenticate with a https & htpasswd protected server:

Authenticator.setDefault(object : Authenticator() {
    override fun getPasswordAuthentication(): PasswordAuthentication {
        return PasswordAuthentication("usernameinplaintext", "passwordinplaintext".toCharArray())
    }
})

var sentBytes: Long = 0
HttpsURLConnection.setDefaultHostnameVerifier(NullHostNameVerifier())
val context = SSLContext.getInstance("TLS")
context.init(null, arrayOf<X509TrustManager>(NullX509TrustManager()), SecureRandom())
HttpsURLConnection.setDefaultSSLSocketFactory(context.socketFactory)

Will the username and password be sent over the internet in plain text?

Aurelius Schnitzler
  • 511
  • 2
  • 8
  • 18

0 Answers0