本文整理了Java中net.oauth.OAuth.addParameters()
方法的一些代码示例,展示了OAuth.addParameters()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。OAuth.addParameters()
方法的具体详情如下:
包路径:net.oauth.OAuth
类名称:OAuth
方法名:addParameters
[英]Construct a URL like the given one, but with the given parameters added to its query string.
[中]构造一个与给定URL类似的URL,但将给定参数添加到其查询字符串中。
代码示例来源:origin: org.wso2.org.apache.shindig/shindig-common
public static String addParameters(String url, List<Entry<String, String>> parameters) {
try {
return OAuth.addParameters(url, parameters);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
代码示例来源:origin: org.gatein.shindig/shindig-common
public static String addParameters(String url, List<Entry<String, String>> parameters) {
try {
return OAuth.addParameters(url, parameters);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
代码示例来源:origin: apache/shindig
public static String addParameters(String url, List<Entry<String, String>> parameters) {
try {
return OAuth.addParameters(url, parameters);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
代码示例来源:origin: com.lmco.shindig/shindig-common
public static String addParameters(String url, List<Entry<String, String>> parameters) {
try {
return OAuth.addParameters(url, parameters);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
代码示例来源:origin: org.apache.shindig/shindig-common
public static String addParameters(String url, List<Entry<String, String>> parameters) {
try {
return OAuth.addParameters(url, parameters);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
代码示例来源:origin: sakaiproject/sakai
/**
* Construct a URL like the given one, but with the given parameters added
* to its query string.
*/
public static String addParameters(String url, String... parameters)
throws IOException {
return addParameters(url, newList(parameters));
}
代码示例来源:origin: net.oauth.core/oauth
/**
* Construct a URL like the given one, but with the given parameters added
* to its query string.
*/
public static String addParameters(String url, String... parameters)
throws IOException {
return addParameters(url, newList(parameters));
}
代码示例来源:origin: apache/roller
callback = OAuth.addParameters(callback, "oauth_token", token);
代码示例来源:origin: org.entando.entando/entando-core-engine
private void returnToConsumer(HttpServletRequest request,
HttpServletResponse response, OAuthAccessor accessor) throws IOException, ServletException {
String callback = request.getParameter("oauth_callback");
if ("none".equals(callback)
&& accessor.consumer.callbackURL != null
&& accessor.consumer.callbackURL.length() > 0) {
callback = accessor.consumer.callbackURL;
}
if( "none".equals(callback) || "oob".equals(callback) ) {
response.setContentType("text/plain");
PrintWriter out = response.getWriter();
out.println("You have successfully authorized '"
+ accessor.consumer.getProperty("description")
+ "'. Please close this browser window and click continue"
+ " in the client.");
out.close();
} else {
if (callback == null || callback.length() <= 0)
callback = accessor.consumer.callbackURL;
String token = accessor.requestToken;
if (token != null) {
callback = OAuth.addParameters(callback, "oauth_token", token);
}
response.setStatus(HttpServletResponse.SC_MOVED_TEMPORARILY);
response.setHeader("Location", callback);
}
}
代码示例来源:origin: com.atlassian.oauth/atlassian-oauth-service-provider-plugin
private void redirectBackToConsumerVersion1(HttpServletRequest request, HttpServletResponse response, ServiceProviderToken token) throws IOException {
String callback = request.getParameter(OAUTH_CALLBACK);
if (isEmpty(callback) && token.getConsumer().getCallback() != null) {
callback = token.getConsumer().getCallback().toString();
}
if (isEmpty(callback)) {
// no call back it must be a client
response.setContentType("text/html");
if (token.getAuthorization() == Authorization.AUTHORIZED) {
// no call back, display the verification code so the user can enter it manually
templateRenderer.render(AUTH_NO_CALLBACK_APPROVAL_V1_TEMPLATE, ImmutableMap.<String, Object>of("token", token), response.getWriter());
} else {
templateRenderer.render(AUTH_NO_CALLBACK_DENIED_TEMPLATE, ImmutableMap.<String, Object>of("token", token), response.getWriter());
}
} else {
if (token.getToken() != null) {
callback = addParameters(callback, "oauth_token", token.getToken());
}
response.sendRedirect(callback);
}
}
代码示例来源:origin: sakaiproject/sakai
switch (style) {
case QUERY_STRING:
url = OAuth.addParameters(url, from.getParameters());
break;
case BODY: {
body = new ByteArrayInputStream(form);
} else {
url = OAuth.addParameters(url, others);
代码示例来源:origin: com.atlassian.oauth/atlassian-oauth-service-provider-plugin
private void redirectBackToConsumerVersion1a(HttpServletRequest request, HttpServletResponse response, ServiceProviderToken token) throws IOException {
URI callback = token.getCallback() == null ? token.getConsumer().getCallback() : token.getCallback();
if (callback == null) {
response.setContentType("text/html");
if (token.getAuthorization() == Authorization.AUTHORIZED) {
// no call back, display the verification code so the user can enter it manually
templateRenderer.render(AUTH_NO_CALLBACK_APPROVAL_V1A_TEMPLATE, ImmutableMap.<String, Object>of("token", token), response.getWriter());
} else {
templateRenderer.render(AUTH_NO_CALLBACK_DENIED_TEMPLATE, ImmutableMap.<String, Object>of("token", token), response.getWriter());
}
} else {
// add the token and verifier parameters to the callback and send the redirect
// if the token was denied, then the verifier is set to a placeholder value in case consumers don't handle
// a blank or missing verifier parameter
response.sendRedirect(addParameters(callback.toString(),
OAUTH_TOKEN, token.getToken(),
OAUTH_VERIFIER, token.getAuthorization() == Authorization.AUTHORIZED ? token.getVerifier() : "denied")
);
}
}
代码示例来源:origin: sakaiproject/sakai
/**
* getOAuthURL - Form a GET request signed by OAuth
* @param method
* @param url
* @param oauth_consumer_key
* @param oauth_secret
* @param signature
*/
public static String getOAuthURL(String method, String url,
String oauth_consumer_key, String oauth_secret, String signature)
{
OAuthMessage om = new OAuthMessage(method, url, null);
om.addParameter(OAuth.OAUTH_CONSUMER_KEY, oauth_consumer_key);
if ( signature == null ) signature = OAuth.HMAC_SHA1;
om.addParameter(OAuth.OAUTH_SIGNATURE_METHOD, signature);
om.addParameter(OAuth.OAUTH_VERSION, "1.0");
om.addParameter(OAuth.OAUTH_TIMESTAMP, new Long((new Date().getTime()) / 1000).toString());
om.addParameter(OAuth.OAUTH_NONCE, UUID.randomUUID().toString());
OAuthConsumer oc = new OAuthConsumer(null, oauth_consumer_key, oauth_secret, null);
try {
OAuthSignatureMethod osm = OAuthSignatureMethod.newMethod(signature, new OAuthAccessor(oc));
osm.sign(om);
url = OAuth.addParameters(url, om.getParameters());
return url;
} catch (Exception e) {
log.error(e.getMessage(), e);
return null;
}
}
代码示例来源:origin: com.lmco.shindig/shindig-social-api
callback = OAuth.addParameters(callback, OAuth.OAUTH_TOKEN, entry.getToken());
callback = OAuth.addParameters(callback, "user_id", entry.getUserId());
if (entry.getCallbackToken() != null) {
callback = OAuth.addParameters(callback, OAuth.OAUTH_VERIFIER,
entry.getCallbackToken());
代码示例来源:origin: apache/incubator-wave
callback = OAuth.addParameters(callback, OAuth.OAUTH_TOKEN, accessor.requestToken);
resp.sendRedirect(callback);
代码示例来源:origin: rometools/rome
message.sign(accessor);
finalUri = OAuth.addParameters(message.URL, message.getParameters());
代码示例来源:origin: org.jboss.resteasy/resteasy-oauth
parameters.add(new OAuth.Parameter(OAuth.OAUTH_TOKEN, requestTokenKey));
parameters.add(new OAuth.Parameter(OAuth.OAUTH_VERIFIER, verifier));
String location = OAuth.addParameters(callback, parameters);
resp.addHeader("Location", location);
resp.setStatus(302);
代码示例来源:origin: com.marvelution.jira.plugins/jenkins-jira-plugin
String newCallback = OAuth.addParameters(callback.toString(), OAuth.OAUTH_TOKEN, token.getToken());
if (token.getVersion() == ServiceProviderToken.Version.V_1_0_A) {
newCallback = OAuth.addParameters(newCallback, OAuth.OAUTH_VERIFIER, token.getAuthorization() == ServiceProviderToken
.Authorization.AUTHORIZED ? token.getVerifier() : "denied");
代码示例来源:origin: edu.uiuc.ncsa.security.delegation/ncsa-security-oauth-1.0a
HttpResponse response = null;
try {
String callback = OAuth.addParameters(CBRequest.getCallbackUri().toString(), parameters);
HttpGet httpget = new HttpGet(callback);
代码示例来源:origin: org.apache.shindig/shindig-social-api
break;
case URI_QUERY:
request.setQueryString(Uri.parse(OAuth.addParameters(url, entryList)).getQuery());
break;
内容来源于网络,如有侵权,请联系作者删除!