org.scribe.utils.OAuthEncoder Java Examples
The following examples show how to use
org.scribe.utils.OAuthEncoder.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Google2Api.java From jpa-invoicer with The Unlicense | 6 votes |
@Override public AccessTokenExtractor getAccessTokenExtractor() { return new AccessTokenExtractor() { @Override public Token extract(String response) { Preconditions.checkEmptyString(response, "Response body is incorrect. Can't extract a token from an empty string"); Matcher matcher = Pattern.compile("\"access_token\" : \"([^&\"]+)\"").matcher(response); if (matcher.find()) { String token = OAuthEncoder.decode(matcher.group(1)); return new Token(token, "", response); } else { throw new OAuthException("Response body is incorrect. Can't extract a token from this: '" + response + "'", null); } } }; }
Example #2
Source File: HubicApi.java From swift-explorer with Apache License 2.0 | 6 votes |
@Override public String getAuthorizationUrl(OAuthConfig config) { Preconditions.checkValidUrl(config.getCallback(), "Must provide a valid url as callback.") ; if (config.hasScope()) { return String.format(SCOPED_AUTHORIZE_URL, config.getApiKey(), OAuthEncoder.encode(config.getCallback()), OAuthEncoder.encode(config.getScope())); } else { return String.format(AUTHORIZE_URL, config.getApiKey(), OAuthEncoder.encode(config.getCallback())); } }
Example #3
Source File: Google2Api.java From jpa-invoicer with The Unlicense | 5 votes |
@Override public String getAuthorizationUrl(OAuthConfig config) { // Append scope if present if (config.hasScope()) { return String.format(SCOPED_AUTHORIZE_URL, config.getApiKey(), OAuthEncoder.encode(config.getCallback()), OAuthEncoder.encode(config.getScope())); } else { return String.format(AUTHORIZE_URL, config.getApiKey(), OAuthEncoder.encode(config.getCallback())); } }
Example #4
Source File: SliApi.java From secure-data-service with Apache License 2.0 | 5 votes |
@Override public String getAuthorizationUrl(OAuthConfig config) { Preconditions.checkValidUrl(config.getCallback(), "Must provide a valid url as callback."); return String.format(REQUEST_TOKEN_FRAGMENT, apiUrl.toString(), config.getApiKey(), OAuthEncoder.encode(config.getCallback())); }
Example #5
Source File: EvernoteAuthToken.java From EverMemo with MIT License | 5 votes |
private String extract(String response, Pattern p) { Matcher matcher = p.matcher(response); if (matcher.find() && matcher.groupCount() >= 1) { return OAuthEncoder.decode(matcher.group(1)); } else { throw new OAuthException("Response body is incorrect. " + "Can't extract token and secret from this: '" + response + "'", null); } }
Example #6
Source File: EvernoteAuthToken.java From EverMemo-EverNote with MIT License | 5 votes |
private String extract(String response, Pattern p) { Matcher matcher = p.matcher(response); if (matcher.find() && matcher.groupCount() >= 1) { return OAuthEncoder.decode(matcher.group(1)); } else { throw new OAuthException("Response body is incorrect. " + "Can't extract token and secret from this: '" + response + "'", null); } }
Example #7
Source File: WeiXinApi20.java From cas4.0.x-server-wechat with Apache License 2.0 | 4 votes |
@Override public String getAuthorizationUrl(OAuthConfig config) { return String.format(url, config.getApiKey(), OAuthEncoder.encode("http://conference.3audit.com/cas-server/login")); }
Example #8
Source File: SliApi.java From secure-data-service with Apache License 2.0 | 4 votes |
@Override public String getAuthorizationUrl(OAuthConfig config) { Preconditions.checkValidUrl(config.getCallback(), "Must provide a valid url as callback."); return String.format(authorizeUrl, config.getApiKey(), OAuthEncoder.encode(config.getCallback())); }