Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 57 for challenges (0.19 sec)

  1. okhttp/src/test/java/okhttp3/HeadersChallengesTest.kt

      }
    
      @Test fun testDigestChallengeWithTokenFormOfAuthParam() {
        val headers =
          Headers.Builder()
            .add("WWW-Authenticate", "Digest realm=myrealm").build()
        val challenges = headers.parseChallenges("WWW-Authenticate")
        assertThat(challenges.size).isEqualTo(1)
        assertThat(challenges[0].scheme).isEqualTo("Digest")
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 16.6K bytes
    - Viewed (0)
  2. okhttp/src/main/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
          }
    
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 3.2K bytes
    - Viewed (0)
  3. okhttp/src/main/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
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Tue Jan 23 14:31:42 GMT 2024
    - 15.5K bytes
    - Viewed (0)
  4. samples/guide/src/main/java/okhttp3/recipes/Authenticate.java

                return null; // Give up, we've already attempted to authenticate.
              }
    
              System.out.println("Authenticating for response: " + response);
              System.out.println("Challenges: " + response.challenges());
              String credential = Credentials.basic("jesse", "password1");
              return response.request().newBuilder()
                  .header("Authorization", credential)
                  .build();
            })
    Java
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Thu Aug 12 07:26:27 GMT 2021
    - 1.9K bytes
    - Viewed (0)
  5. 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()
              }
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 1.9K bytes
    - Viewed (0)
  6. okhttp/src/main/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)
          }
        }
      }
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 7.2K bytes
    - Viewed (0)
  7. 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
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Fri Feb 18 08:52:22 GMT 2022
    - 40.2K bytes
    - Viewed (1)
  8. okhttp/src/main/kotlin/okhttp3/Connection.kt

     * connection is typically faster than establishing a new one.
     *
     * When a single logical call requires multiple streams due to redirects or authorization
     * challenges, we prefer to use the same physical connection for all streams in the sequence. There
     * are potential performance and behavior consequences to this preference. To support this feature,
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Wed Dec 20 23:27:07 GMT 2023
    - 4.3K bytes
    - Viewed (0)
  9. okhttp-testing-support/src/main/kotlin/okhttp3/internal/RecordingOkAuthenticator.kt

        return response.request.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) }
      }
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 1.7K bytes
    - Viewed (0)
  10. okhttp/src/main/kotlin/okhttp3/Authenticator.kt

     * challenge. The proxy authenticator may return either an authenticated request, or null to
     * connect without authentication.
     *
     * ```java
     * for (Challenge challenge : response.challenges()) {
     *   // If this is preemptive auth, use a preemptive credential.
     *   if (challenge.scheme().equalsIgnoreCase("OkHttp-Preemptive")) {
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 5.5K bytes
    - Viewed (0)
Back to top