Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 1 - 10 of 71 for challenges (0.07 seconds)

  1. okhttp/src/jvmTest/kotlin/okhttp3/HeadersChallengesTest.kt

                "jdflkasdf\", qop=\"auth\", stale=\"FALSE\"",
            ).build()
        val challenges = headers.parseChallenges("WWW-Authenticate")
        assertThat(challenges.size).isEqualTo(1)
        assertThat(challenges[0].scheme).isEqualTo("Digest")
        assertThat(challenges[0].realm).isEqualTo("myrealm")
        val expectedAuthParams = mutableMapOf<String, String>()
        expectedAuthParams["realm"] = "myrealm"
    Created: Fri Dec 26 11:42:13 GMT 2025
    - Last Modified: Wed Mar 19 19:25:20 GMT 2025
    - 16.8K bytes
    - Click Count (0)
  2. okhttp/src/commonJvmAndroid/kotlin/okhttp3/internal/authenticator/JavaNetAuthenticator.kt

        route: Route?,
        response: Response,
      ): Request? {
        val challenges = response.challenges()
        val request = response.request
        val url = request.url
        val proxyAuthorization = response.code == 407
        val proxy = route?.proxy ?: Proxy.NO_PROXY
    
        for (challenge in challenges) {
          if (!"Basic".equals(challenge.scheme, ignoreCase = true)) {
            continue
          }
    
    Created: Fri Dec 26 11:42:13 GMT 2025
    - Last Modified: Wed Mar 19 19:25:20 GMT 2025
    - 3.2K bytes
    - Click Count (0)
  3. okhttp/src/commonJvmAndroid/kotlin/okhttp3/Response.kt

      /**
       * Returns the RFC 7235 authorization challenges appropriate for this response's code. If the
       * response code is 401 unauthorized, this returns the "WWW-Authenticate" challenges. If the
       * response code is 407 proxy unauthorized, this returns the "Proxy-Authenticate" challenges.
       * Otherwise this returns an empty list of challenges.
       *
       * If a challenge uses the `token68` variant instead of auth params, there is exactly one
    Created: Fri Dec 26 11:42:13 GMT 2025
    - Last Modified: Mon Jul 28 14:39:28 GMT 2025
    - 18.1K bytes
    - Click Count (0)
  4. samples/guide/src/main/java/okhttp3/recipes/kt/Authenticate.kt

                  return null // Give up, we've already attempted to authenticate.
                }
    
                println("Authenticating for response: $response")
                println("Challenges: ${response.challenges()}")
                val credential = Credentials.basic("jesse", "password1")
                return response.request
                  .newBuilder()
                  .header("Authorization", credential)
                  .build()
    Created: Fri Dec 26 11:42:13 GMT 2025
    - Last Modified: Wed Mar 19 19:25:20 GMT 2025
    - 2K bytes
    - Click Count (0)
  5. okhttp/src/commonJvmAndroid/kotlin/okhttp3/internal/http/HttpHeaders.kt

     */
    fun Headers.parseChallenges(headerName: String): List<Challenge> {
      val result = mutableListOf<Challenge>()
      for (h in 0 until size) {
        if (headerName.equals(name(h), ignoreCase = true)) {
          val header = Buffer().writeUtf8(value(h))
          try {
            header.readChallengeHeader(result)
          } catch (e: EOFException) {
            Platform.get().log("Unable to parse challenge", Platform.WARN, e)
          }
        }
      }
    Created: Fri Dec 26 11:42:13 GMT 2025
    - Last Modified: Mon May 05 16:01:00 GMT 2025
    - 7.2K bytes
    - Click Count (0)
  6. docs/recipes.md

    Use `Response.challenges()` to get the schemes and realms of any authentication challenges. When fulfilling a `Basic` challenge, use `Credentials.basic(username, password)` to encode the request header.
    
    === ":material-language-kotlin: Kotlin"
        ```kotlin
    Created: Fri Dec 26 11:42:13 GMT 2025
    - Last Modified: Sat Aug 30 17:01:12 GMT 2025
    - 47.8K bytes
    - Click Count (0)
  7. okhttp-testing-support/src/main/kotlin/okhttp3/internal/RecordingOkAuthenticator.kt

          .newBuilder()
          .addHeader(header, credential)
          .build()
      }
    
      private fun schemeMatches(response: Response): Boolean {
        if (scheme == null) return true
        return response.challenges().any { it.scheme.equals(scheme, ignoreCase = true) }
      }
    Created: Fri Dec 26 11:42:13 GMT 2025
    - Last Modified: Wed Mar 19 19:25:20 GMT 2025
    - 1.7K bytes
    - Click Count (0)
  8. src/test/java/jcifs/http/NtlmServletTest.java

        }
    
        /**
         * Test the service method when no Authorization header is present and no session exists.
         * Expects a 401 Unauthorized response with NTLM and Basic authentication challenges.
         * @throws ServletException
         * @throws IOException
         */
        @Test
        void testService_NoAuthHeader_NoSession() throws ServletException, IOException {
            ntlmServlet.init(servletConfig);
    Created: Sat Dec 20 13:44:44 GMT 2025
    - Last Modified: Thu Aug 21 04:51:33 GMT 2025
    - 11.5K bytes
    - Click Count (0)
  9. okhttp/src/commonJvmAndroid/kotlin/okhttp3/internal/http/RetryAndFollowUpInterceptor.kt

        if (header.matches("\\d+".toRegex())) {
          return Integer.valueOf(header)
        }
        return Integer.MAX_VALUE
      }
    
      companion object {
        /**
         * How many redirects and auth challenges should we attempt? Chrome follows 21 redirects; Firefox,
         * curl, and wget follow 20; Safari follows 16; and HTTP/1.0 recommends 5.
         */
        private const val MAX_FOLLOW_UPS = 20
      }
    Created: Fri Dec 26 11:42:13 GMT 2025
    - Last Modified: Tue May 27 14:58:02 GMT 2025
    - 12.4K bytes
    - Click Count (0)
  10. src/test/java/jcifs/http/NtlmHttpFilterTest.java

            // Since we can't mock the internal transport operations easily without real network,
            // we'll test the simpler case where no NTLM negotiation is needed
            when(request.getHeader("Authorization")).thenReturn(null);
    
            filter.doFilter(request, response, filterChain);
    
            // Should challenge the client
    Created: Sat Dec 20 13:44:44 GMT 2025
    - Last Modified: Thu Aug 21 04:51:33 GMT 2025
    - 12.8K bytes
    - Click Count (0)
Back to Top