当前位置: 首页>>代码示例>>Java>>正文


Java OAuth.OAUTH_CONSUMER_KEY属性代码示例

本文整理汇总了Java中net.oauth.OAuth.OAUTH_CONSUMER_KEY属性的典型用法代码示例。如果您正苦于以下问题:Java OAuth.OAUTH_CONSUMER_KEY属性的具体用法?Java OAuth.OAUTH_CONSUMER_KEY怎么用?Java OAuth.OAUTH_CONSUMER_KEY使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在net.oauth.OAuth的用法示例。


在下文中一共展示了OAuth.OAUTH_CONSUMER_KEY属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: registerMessagingServiceScopes

public void registerMessagingServiceScopes(String consumerKey, String scope) throws Exception
{
   WebTarget target = ClientBuilder.newClient().target(ConsumerScopesRegistrationURL);
   String base64Credentials = new String(Base64.encodeBytes("admin:admin".getBytes()));
   Invocation.Builder builder = target.request();
   builder.header("Authorization", "Basic " + base64Credentials);
   Form form = new Form(OAuth.OAUTH_CONSUMER_KEY, consumerKey);
   form.param("xoauth_scope", scope);
   form.param("xoauth_permission", "sendMessages");
   Response response = null;
   try {
      response = builder.post(Entity.form(form));
      if (HttpResponseCodes.SC_OK != response.getStatus()) {
         throw new RuntimeException("Scopes can not be registered");
      }
   } finally {
      response.close();
   }
}
 
开发者ID:resteasy,项目名称:resteasy-examples,代码行数:19,代码来源:Subscriber.java

示例2: getSharedSecret

public String getSharedSecret(String consumerKey) throws Exception
{
   WebTarget target = ClientBuilder.newClient().target(ConsumerRegistrationURL);
   Invocation.Builder builder = target.request();
   Form form = new Form(OAuth.OAUTH_CONSUMER_KEY, consumerKey);
   Entity<Form> formEntity = Entity.form(form);
   Response response = builder.post(formEntity);
   if (HttpResponseCodes.SC_OK != response.getStatus()) {
      response.close();
      throw new RuntimeException("Registration failed");
   }
   // check that we got all tokens
   Map<String, String> tokens = OAuth.newMap(OAuth.decodeForm(response.readEntity(String.class)));
   String secret = tokens.get("xoauth_consumer_secret");
   if (secret == null) {
      throw new RuntimeException("No secret available");
   }
   return secret;
}
 
开发者ID:resteasy,项目名称:resteasy-examples,代码行数:19,代码来源:ConsumerResource.java

示例3: registerMessagingServiceScopes

public void registerMessagingServiceScopes(String consumerKey, String scope) throws Exception
{
   WebTarget target = ClientBuilder.newClient().target(ConsumerScopesRegistrationURL);
   Invocation.Builder builder = target.request();
   builder.header("Authorization", "OpenId " + SubscriberOpenIdIdentifier);
   Form form = new Form(OAuth.OAUTH_CONSUMER_KEY, consumerKey);
   form.param("xoauth_scope", scope);
   form.param("xoauth_permission", "sendMessages");
   Response response = builder.post(Entity.form(form));
   response.close();
   if (HttpResponseCodes.SC_OK != response.getStatus()) {
      throw new RuntimeException("Scopes can not be registered");
   }
}
 
开发者ID:resteasy,项目名称:resteasy-examples,代码行数:14,代码来源:Subscriber.java

示例4: generateOAuthHeader

private StringTokenizer generateOAuthHeader(String address) {
  return new StringTokenizer("OAuth " + OAuth.OAUTH_CONSUMER_KEY + "=\"" + address + "\"", "");
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:3,代码来源:ActiveApiServletTest.java


注:本文中的net.oauth.OAuth.OAUTH_CONSUMER_KEY属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。