An example of OAuth external service that uses the Restlet OAuth example server.
Please note that the example server is flawed which I have detailed here.
Although the implementation is not fully secure in many ways, it is sufficient enough to provide an implementation an OAuth sevice and external access using the Restlet framework.
Code has been slightly modified from the original project located here.
- Compile a JAR of the latest version of the OAuth extentsion, since some classes are missing in the
2.2-M3
release. Update the Maven dependency based the compiled JAR's location. (The lib folder has the JAR file I compiled.) - Run the project using Maven, or run the OAuth2Sample class.
mvn exec:java
- Open your web browser to http://localhost:8080/sample/
- Click on the login button.
- Login with the example user
bob
and password123456
. - Accept or deny the request for default scope.
All source code from the Restlet project is license under the Apache 2.0 license with copyright as its respective owners.
Code that I have written is also license under the Apache 2.0 license for simplicity sake.