使用Oauth库在Java中创建“Provider”?

时间:2011-02-21 23:19:24

标签: java oauth oauth-provider

我下载了编译的示例(https://code.google.com/p/oauth/)并将提供者和消费者WAR文件加载到Apache Tomcat。

我将 provider.properties配置为: Consumer_key = mysecret(我不确定我是否可以将其设为关键) Consumer_key.description =获取GPS位置 Consumer_key.callbackURL = HTTP://本地主机:8081 / oauthC / OAuth的/回调

consumer.properties with: sample.serviceProvider.baseURL:http://localhost:8081/oauthP/ sample.serviceProvider.requestTokenURL:request_token sample.serviceProvider.userAuthorizationURL:authorize sample.serviceProvider.accessTokenURL:access_token sample.consumerKey:mysecret sample.consumerSecret:mysecret(我很困惑,我应该在这个attr中设置什么)

启动服务器。我访问了http://localhost:8081/oauthC/(消费者网站)去示例,它返回了这个:

OAuthProblemException: oauth_problem:token_rejected

HTTP请求: GET / oauthP / request_token?oauth_callback = http%3A%2F%2Flocalhost%3A8081%2FoauthC%2FOAuth%2FCallback%3Fconsumer%3Dsample%26returnTo%3D%252FoauthC%252FSampleProvider& oauth_consumer_key = mysecret&安培; oauth_signature_method = HMAC-SHA1&安培; oauth_timestamp = 1298329818&安培; oauth_nonce = 13474056411695&安培; oauth_version = 1.0&安培; oauth_signature = JwuEr0jprO8G3bKRhXHdqpeuuxI%3D 用户代理:Jakarta Commons-HttpClient / 3.1 主持人:localhost:8081

HTTP状态:401

HTTP响应: HTTP / 1.1 401未经授权 服务器:Apache-Coyote / 1.1 WWW-Authenticate:OAuth realm =“http%3A%2F%2Flocalhost.localdomain”,oauth_problem =“token_rejected” Content-Type:application / x-www-form-urlencoded; charset = UTF-8 内容长度:28 日期:2011年2月21日星期一23:10:18格林尼治标准时间 oauth_problem = token_rejected

oauth_signature base string: GET& http%3A%2F%2Flocalhost%3A8081%2FoauthP%2Frequest_token& oauth_callback%3Dhttp%253A%252F%252Flocalhost%253A8081%252FoauthC%252FOAuth%252FCallback%253Fconsumer% 253Dsample%2526returnTo%253D%25252FoauthC%25252FSampleProvider%26oauth_consumer_key%3Dmysecret%26oauth_nonce%3D13474056411695%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1298329818%26oauth_version%3D1.0

网址 http://localhost:8081/oauthP/request_token?oauth_callback=http%3A%2F%2Flocalhost%3A8081%2FoauthC%2FOAuth%2FCallback%3Fconsumer%3Dsample%26returnTo%3D%252FoauthC%252FSampleProvider&oauth_consumer_key=mysecret&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1298329818&oauth_nonce=13474056411695&oauth_version=1.0&oauth_signature=JwuEr0jprO8G3bKRhXHdqpeuuxI%3D

我被困在这里。有人可以给个建议吗?或者给我看一下这个lib的文档?我找不到任何东西......

你的时间

0 个答案:

没有答案