{"id":18996929,"url":"https://github.com/rburgst/okhttp-digest","last_synced_at":"2025-05-16T03:04:37.038Z","repository":{"id":2417996,"uuid":"44053515","full_name":"rburgst/okhttp-digest","owner":"rburgst","description":"a digest authenticator for okhttp","archived":false,"fork":false,"pushed_at":"2024-10-20T07:12:51.000Z","size":598,"stargazers_count":194,"open_issues_count":0,"forks_count":43,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-04-08T13:11:17.487Z","etag":null,"topics":["android","digest-authentication","okhttp"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rburgst.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-10-11T13:39:37.000Z","updated_at":"2025-04-08T08:02:58.000Z","dependencies_parsed_at":"2024-11-08T17:41:39.382Z","dependency_job_id":"d43d60a7-b102-4557-b52e-1dcf2b43e595","html_url":"https://github.com/rburgst/okhttp-digest","commit_stats":{"total_commits":192,"total_committers":17,"mean_commits":"11.294117647058824","dds":0.390625,"last_synced_commit":"b6c7f0556864114733e4eeb26622affd34035ce7"},"previous_names":[],"tags_count":36,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rburgst%2Fokhttp-digest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rburgst%2Fokhttp-digest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rburgst%2Fokhttp-digest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rburgst%2Fokhttp-digest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rburgst","download_url":"https://codeload.github.com/rburgst/okhttp-digest/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254459088,"owners_count":22074605,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","digest-authentication","okhttp"],"created_at":"2024-11-08T17:37:37.738Z","updated_at":"2025-05-16T03:04:32.021Z","avatar_url":"https://github.com/rburgst.png","language":"Java","readme":"# okhttp-digest\nA digest authenticator for okhttp. Most of the code is \nported from Apache Http Client.\n\n### Important\n\nThis artifact has moved from jcenter to maven central! The coordinates have changed from\n\n`com.burgstaller:okhttp-digest:\u003cversion\u003e` to `io.github.rburgst:okhttp-digest:\u003cversion\u003e`\n\nFor more details, see [#71](https://github.com/rburgst/okhttp-digest/issues/71).\n\n\n# Usage\n\n```java\nfinal DigestAuthenticator authenticator = new DigestAuthenticator(new Credentials(\"username\", \"pass\"));\n\nfinal Map\u003cString, CachingAuthenticator\u003e authCache = new ConcurrentHashMap\u003c\u003e();\nfinal OkHttpClient client = new OkHttpClient.Builder()\n        .authenticator(new CachingAuthenticatorDecorator(authenticator, authCache))\n        .addInterceptor(new AuthenticationCacheInterceptor(authCache))\n        .build();\n\nString url = \"http://www.google.com\";\nRequest request = new Request.Builder()\n        .url(url)\n        .get()\n        .build();\nResponse response = client.newCall(request).execute();\n```\n\nIf you want to support multiple authentication schemes (including auth caching) then this should\nwork:\n\n```java\nfinal OkHttpClient.Builder builder = new OkHttpClient.Builder();\nfinal Map\u003cString, CachingAuthenticator\u003e authCache = new ConcurrentHashMap\u003c\u003e();\n\nfinal Credentials credentials = new Credentials(\"username\", \"pass\");\nfinal BasicAuthenticator basicAuthenticator = new BasicAuthenticator(credentials);\nfinal DigestAuthenticator digestAuthenticator = new DigestAuthenticator(credentials);\n\n// note that all auth schemes should be registered as lowercase!\nDispatchingAuthenticator authenticator = new DispatchingAuthenticator.Builder()\n        .with(\"digest\", digestAuthenticator)\n        .with(\"basic\", basicAuthenticator)\n        .build();\n\nfinal OkHttpClient client = builder\n        .authenticator(new CachingAuthenticatorDecorator(authenticator, authCache))\n        .addInterceptor(new AuthenticationCacheInterceptor(authCache, new DefaultRequestCacheKeyProvider()))\n        .addNetworkInterceptor(logger)\n        .build();\n```\nIf you want to cache Proxy credentials, you need to add a NetworkInterceptor : \n\n```java\nfinal OkHttpClient client = builder\n        .authenticator(new CachingAuthenticatorDecorator(authenticator, authCache))\n        .addNetworkInterceptor(new AuthenticationCacheInterceptor(authCache, new DefaultProxyCacheKeyProvider()))\n        .addNetworkInterceptor(logger)\n        .build();\n```\n\nYou can also combine Proxy AND Web site Authentication :\n\n```java\nfinal OkHttpClient client = builder\n        .authenticator(new CachingAuthenticatorDecorator(authenticator, authCache))\n        .addNetworkInterceptor(new AuthenticationCacheInterceptor(authCache,new DefaultProxyCacheKeyProvider()))\n        .addInterceptor(new AuthenticationCacheInterceptor(authCache,new DefaultRequestCacheKeyProvider()))        \n        .addNetworkInterceptor(logger)\n        .build();\n```\n\n[![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.github.rburgst/okhttp-digest/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.github.rburgst/okhttp-digest)\n[![Build Status](https://github.com/rburgst/okhttp-digest/actions/workflows/gradle.yml/badge.svg)](https://github.com/rburgst/okhttp-digest/actions/workflows/gradle.yml)\n\n## Use via gradle\n\n```groovy\nimplementation 'io.github.rburgst:okhttp-digest:3.1.1'\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frburgst%2Fokhttp-digest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frburgst%2Fokhttp-digest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frburgst%2Fokhttp-digest/lists"}