I am going to integrate already existing .NET web application, OAuth 2.0 Authorization service written in .NET using DotNetOpenAuth with Java web application. But I am .NET developer, so almost no idea about Java. Goal is to provide single sign-on from .NET web application to Java web application using this authorization service.
All needed from Java web application is to validate OAuth 2.0 access token send to it, because .NET web application has already obtained access token from Authorization service. And is making request to Java web application. In this case Java web application is considered as Resource server (according to roles from OAuth 2.0 standard, for obtianing token Resource Owner Credentials Password flow is used from .NET web app)
Result of request to obtain access token issued by DotNetOpenAuth looks like:
{
"access_token": "gAAAAH44atDAyWeu8BFwhLof7rtBRpiZrSlAC0zci8xU81tXHZDVkBX8LXrMLDHDYfimjuSOsdrXQIAY7Xf4JnK1x_fo_JSmvuiA5CvO5JUJNuEmHNSlR4ePO4tBPkOHQnN50DIRJMbHJdQrFZCqqaWz6s0iuvCuTMcTua6J0yaTPQaD9AAAAIAAAADHgef78SHh4-K2aZ87xYRoRFfmQ0lc3ET7Y5vAS7BadLM5btYvmrSkAWsCxhUji92D0LbKgyVkbQuuw5LnRP_zsxe_W_VztTqZ5m9PwJDL6q7McrUfiVQj_XBQqpv2slBeouD0F1k1KjVedR9Pwm7ganz4R7dmeYivnx8f0_isEGBqSZrtnILoit3SOCPyVxmIwizYwLE2bQOtlwVpqtrBMyzc4MVPVyaSiJb2-Lj5tOftEWl0k93Qmr8uzmjDyeCn3TsFX0f_qFgCmxp32_kt4ZTMf4zgmh5yUS1Hy7ERNQxpCIxRTx9yma7JN_K5Pss",
"token_type": "bearer",
"expires_in": 43200,
}
Question is what java library should be used to validate this token? Spring security OAuth? Does format of access token issued by DotNetOpenAuth could be parsed and validated by this java library?
Java Project Eclipse Lyo
use OAuth:
I found in source code validation : https://eclipse.googlesource.com/lyo/org.eclipse.lyo.server/+/b0f230907c3135da5e65d663b8a8261f99cdc7b8/org.eclipse.lyo.server.oauth.webapp.sample/src/main/java/org/eclipse/lyo/server/oauth/webapp/sample/SecureHelloWorld.java
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.