Skip to content
This repository has been archived by the owner on May 3, 2024. It is now read-only.

Commit

Permalink
Don't use OAuth'd requests if OAuth is disabled (#462)
Browse files Browse the repository at this point in the history
  • Loading branch information
buttilda authored Jan 29, 2024
1 parent d785d72 commit a22668f
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,19 @@
import org.zalando.fahrschein.ManagedCursorManager;
import org.zalando.fahrschein.http.api.RequestFactory;
import org.zalando.spring.boot.fahrschein.nakadi.config.properties.AbstractConfig;
import org.zalando.spring.boot.fahrschein.nakadi.config.properties.OAuthConfig;

import java.net.URI;

class CursorManagerFactory {

static CursorManager create(AbstractConfig config, RequestFactory requestFactory) {
return new ManagedCursorManager(URI.create(config.getNakadiUrl()), requestFactory,
OAuth.buildAccessTokenProvider(config.getOauth()));
OAuthConfig oauth = config.getOauth();
if (oauth.getEnabled()) {
return new ManagedCursorManager(URI.create(config.getNakadiUrl()), requestFactory,
OAuth.buildAccessTokenProvider(oauth));
}

return new ManagedCursorManager(URI.create(config.getNakadiUrl()), requestFactory);
}
}

0 comments on commit a22668f

Please sign in to comment.