Java的OAuth解析和验证包 joauth
joauth 是 Java 实现用来解析和验证 OAuth 请求的类库。
- Supports OAuth 1.0a and 2.0
- Uses thrust.HttpRequest, which can be used to wrap HttpServletRequests or other HTTP Request representations
- Unpacks Requests, extracts and verifies OAuth parameters from headers, GET, and POST
- Incidentally parses Non-OAuth GET and POST parameters and makes them accessible via a callback
- Custom callbacks to obtain scheme and path from the request in a non-standard way
- Configurable timestamp checking
- Correctly works around various weird URLEncoder bugs in the JVM
- Written in Scala, but should work pretty well with Java
示例代码:
import com.推ter.joauth.{Verifier, VerifierResult} val verify = Verifier() verify(oAuth1Request, tokenSecret, consumerSecret) match { case VerifierResult.BAD_NONCE => // handle bad nonce case VerifierResult.BAD_SIGNATURE => // handle bad signature case VerifierResult.BAD_TIMESTAMP => // handle bad timestamp case VerifierResult.OK => //success! }
本文由用户 openkk 自行上传分享,仅供网友学习交流。所有权归原作者,若您的权利被侵害,请联系管理员。
转载本站原创文章,请注明出处,并保留原始链接、图片水印。
本站是一个以用户分享为主的开源技术平台,欢迎各类分享!