tonyxx7 / myspaceid-java-sdk

Automatically exported from code.google.com/p/myspaceid-java-sdk
MIT License
0 stars 0 forks source link

README -- MySpaceID

This package is the Java SDK for MySpaceID, which lets your web servers communicate with MySpace servers to request user data.

How to Run the Samples

Simply point your app server to the sample directory, start your app server, and point your browser to the index.jsp file in the sample directory.

The samples have been built to run out of the box, but you must make sure to run them using the correct path. This is described when you first access the index.jsp file in the samples directory.

The samples use a consumer key/secret pair for demo purposes. For your own development, you must obtain your own. If you use OpenID, you must also set up your realm. If you haven't already, visit the MySpace Developer site (http://developer.myspace.com) to set things up. Please see http://developerwiki.myspace.com/index.php?title=How_to_Set_Up_a_New_Application_for_OpenID for a walkthrough.

IMPORTANT: The domain on which you run your server MUST be entered as a realm on your MySpace app configuration page. In order for the samples to work you MUST INCLUDE A SLASH AT THE END OF YOUR DOMAIN, e.g. http://your-domain:3000/, when you enter it as a realm.

Overview of the Samples

OAuth

This sample demonstrates an OAuth Consumer application by implementing the OAuth delegated access flow ("3 legged oauth"). Once the User authorizes the Consumer's request, it fetches the user's profile and friend information using the library.

Hybrid

This sample demonstrates an OpenID "Combined Consumer" by implementing the openid/oauth "hybrid" spec as specified at: http://step2.googlecode.com/svn/spec/openid_oauth_extension/latest/openid_oauth_extension.html

This sample also demonstrates interaction with MySpace using the MySpace library to fetch the user's profile and friends data.

NOTE: Please note that in the samples above we store the access token in the session. But, in a real application you would probably need to store it an the user database so that you can call the MySpace API methods in the future using the stored access token.

Types of Applications

This SDK may be used in the following situations:

  1. External Website: You have a website and you want your users to be able to log on using their MySpace accounts. After a user logs on, this SDK will allow you to fetch his/her data such as name, friends, etc., from MySpace. See below for options on implementing authentication.

  2. On-site App: You have a MySpace on-site application and you need to write server-side code that accesses user data. This SDK allows you to access user data without the need for authentication.

In the first case, you will need to authenticate the user. In the second case, authentication is not necessary, and you will be able to fetch information about any user who has installed your application.

Documentation

The best way to get something working is to customize the existing samples.
But if you need additional documentation, please refer to:

Package Contents

build.xml - Ant build configuration

LICENSE - MIT license. The openid4java portions remain under the Apache license:

doc/ - Javadoc for this SDK's API

lib/ - Jar libraries needed

sample/ - Sample apps demonstrating OAuth and OpenID-OAuth hybrid.

src/ - Source code. The sample consumer servlet org/openid4java/samples/consumer-servlet/ConsumerServlet.java has been adapated and is used by the OpenID-OAuth hybrid sample.

Note: this package is built on top of the openid4java package with minor modifications. Its source code only is included here, but if you need the entire package, it is available at http://code.google.com/p/openid4java/.