SignpostOAuth签名开发包
Signpost 是一个简单而且直观的使用 OAuth 1.0 规范对 HTTP 消息进行签名的 Java 解决方案。支持的 HTTP 客户端包有:
- Java HttpURLConnection
- Apache Commons HTTP 4.x
- Jetty HTTP Client v6.x
示例代码:
// create an HTTP request to a protected resource
URL url = new URL("http://api.example.com/protected")
HttpURLConnection request = (HttpURLConnection) url.openConnection();
// sign the request (consumer is a Signpost DefaultOAuthConsumer)
consumer.sign(request);
// send the request
request.connect();
评论