package com.github.scribejava.core.model; import com.github.scribejava.core.httpclient.HttpClient; import com.github.scribejava.core.httpclient.HttpClientConfig; import java.io.IOException; import java.io.OutputStream; /** * Parameter object that groups OAuth config values */ public class OAuthConfig { private final String apiKey; private final String apiSecret; private final String callback; private final String scope; private final OutputStream debugStream; private final String state; private final String responseType; private final String userAgent; private HttpClientConfig httpClientConfig; private HttpClient httpClient; public OAuthConfig(String key, String secret) { this(key, secret, null, null, null, null, null, null, null, null); } public OAuthConfig(String apiKey, String apiSecret, String callback, String scope, OutputStream debugStream, String state, String responseType, String userAgent, HttpClientConfig httpClientConfig, HttpClient httpClient) { this.apiKey = apiKey; this.apiSecret = apiSecret; this.callback = callback; this.scope = scope; this.debugStream = debugStream; this.state = state; this.responseType = responseType; this.userAgent = userAgent; this.httpClientConfig = httpClientConfig; this.httpClient = httpClient; } public String getApiKey() { return apiKey; } public String getApiSecret() { return apiSecret; } public String getCallback() { return callback; } public String getScope() { return scope; } public String getState() { return state; } public String getResponseType() { return responseType; } public String getUserAgent() { return userAgent; } public void log(String message) { if (debugStream != null) { message += '\n'; try { debugStream.write(message.getBytes("UTF8")); } catch (IOException | RuntimeException e) { throw new RuntimeException("there were problems while writting to the debug stream", e); } } } public HttpClientConfig getHttpClientConfig() { return httpClientConfig; } public HttpClient getHttpClient() { return httpClient; } }