use of com.github.scribejava.core.model.OAuthConfig in project scribejava by scribejava.
the class ImgurOAuthServiceImpl method createAccessTokenRequest.
@Override
protected OAuthRequest createAccessTokenRequest(String oauthVerifier) {
final DefaultApi20 api = getApi();
final OAuthRequest request = new OAuthRequest(api.getAccessTokenVerb(), api.getAccessTokenEndpoint());
final OAuthConfig config = getConfig();
request.addBodyParameter(OAuthConstants.CLIENT_ID, config.getApiKey());
request.addBodyParameter(OAuthConstants.CLIENT_SECRET, config.getApiSecret());
if (ImgurApi.isOob(config)) {
request.addBodyParameter(OAuthConstants.GRANT_TYPE, "pin");
request.addBodyParameter("pin", oauthVerifier);
} else {
request.addBodyParameter(OAuthConstants.GRANT_TYPE, OAuthConstants.AUTHORIZATION_CODE);
request.addBodyParameter(OAuthConstants.CODE, oauthVerifier);
}
return request;
}
use of com.github.scribejava.core.model.OAuthConfig in project scribejava by scribejava.
the class OAuth10aService method prepareRequestTokenRequest.
protected OAuthRequest prepareRequestTokenRequest() {
final OAuthRequest request = new OAuthRequest(api.getRequestTokenVerb(), api.getRequestTokenEndpoint());
final OAuthConfig config = getConfig();
config.log("setting oauth_callback to " + config.getCallback());
request.addOAuthParameter(OAuthConstants.CALLBACK, config.getCallback());
addOAuthParams(request, "");
appendSignature(request);
return request;
}
use of com.github.scribejava.core.model.OAuthConfig in project scribejava by scribejava.
the class OAuth10aService method prepareAccessTokenRequest.
protected OAuthRequest prepareAccessTokenRequest(OAuth1RequestToken requestToken, String oauthVerifier) {
final OAuthRequest request = new OAuthRequest(api.getAccessTokenVerb(), api.getAccessTokenEndpoint());
final OAuthConfig config = getConfig();
request.addOAuthParameter(OAuthConstants.TOKEN, requestToken.getToken());
request.addOAuthParameter(OAuthConstants.VERIFIER, oauthVerifier);
config.log("setting token to: " + requestToken + " and verifier to: " + oauthVerifier);
addOAuthParams(request, requestToken.getTokenSecret());
appendSignature(request);
return request;
}
use of com.github.scribejava.core.model.OAuthConfig in project scribejava by scribejava.
the class ServiceBuilderTest method shouldAcceptValidCallbackUrl.
@Test
public void shouldAcceptValidCallbackUrl() {
builder.apiKey("key").apiSecret("secret").callback("http://example.com").build(api);
final OAuthConfig config = api.getConfig();
assertEquals(config.getApiKey(), "key");
assertEquals(config.getApiSecret(), "secret");
assertEquals(config.getCallback(), "http://example.com");
}
use of com.github.scribejava.core.model.OAuthConfig in project alf.io by alfio-event.
the class StripeManager method getConnectURL.
public ConnectURL getConnectURL(Function<ConfigurationKeys, Configuration.ConfigurationPathKey> keyResolver) {
String secret = configurationManager.getRequiredValue(keyResolver.apply(STRIPE_SECRET_KEY));
String clientId = configurationManager.getRequiredValue(keyResolver.apply(STRIPE_CONNECT_CLIENT_ID));
String callbackURL = configurationManager.getStringConfigValue(keyResolver.apply(STRIPE_CONNECT_CALLBACK), configurationManager.getRequiredValue(keyResolver.apply(BASE_URL)) + CONNECT_REDIRECT_PATH);
String state = UUID.randomUUID().toString();
String code = UUID.randomUUID().toString();
OAuthConfig config = new OAuthConfig(clientId, secret, callbackURL, "read_write", null, state, "code", null, null, null);
return new ConnectURL(new StripeConnectApi().getAuthorizationUrl(config, Collections.emptyMap()), state, code);
}
Aggregations