···5252 val authAccountDid
5353 get() = authAccount.username
54545555+ /** The PDS host of the account used for authentication. */
5656+ val authAccountPdsHost
5757+ get() = authAccount.pdsHost
55585659 /** Create a new auth session. */
5760 suspend fun createSession() {
+21-2
darkfeed/src/main/kotlin/api/AuthPlugin.kt
···1717 val authMutex = Mutex()
1818 val log = LoggerFactory.getLogger(LOGGER_NAME)
19192020+ fun isAuthRequired(url: Url): Boolean {
2121+ val ownerPdsUrl = Url(authManager.authAccountPdsHost)
2222+2323+ return when (url.host) {
2424+ ownerPdsUrl.host -> when {
2525+ url.segments.containsAll(listOf("xrpc", "com.atproto.repo.putRecord")) -> true
2626+ else -> false
2727+ }
2828+2929+ else -> false
3030+ }
3131+ }
3232+2033 // Add authorization header to requests.
2134 onRequest { request, _ ->
2235 // Format the request's endpoint as '<protocol>://<host>/<path>' for use in logs.
2323- val endpoint = with(request.url) { "${protocol.name}://${host}${encodedPath}" }
3636+ val endpoint = with(request.url) { "${protocol.name}://${host}/${encodedPath}" }
3737+3838+ // Check if authorization is required.
3939+ if (!isAuthRequired(request.url.build())) {
4040+ log.debug("Not adding 'Authorization' header on request to '{}'", endpoint)
4141+ return@onRequest
4242+ }
24432544 // Remove any existing `Authorization` headers.
2645 if (request.headers.contains(HttpHeaders.Authorization)) {
···5473 // Check responses for authorization failures.
5574 on(Send) { request ->
5675 // Format the request's endpoint as '<protocol>://<host>/<path>' for use in logs.
5757- val endpoint = with(request.url) { "${protocol.name}://${host}${encodedPath}" }
7676+ val endpoint = with(request.url) { "${protocol.name}://${host}/${encodedPath}" }
58775978 // Send the request.
6079 val originalCall = proceed(request)