0N/A------------------------------------------------------------------------
2362N/A DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
0N/A
0N/ACopyright (c) 2009 Sun Microsystems Inc. All Rights Reserved
0N/A
0N/AThe contents of this file are subject to the terms
2362N/Aof the Common Development and Distribution License
0N/A(the License). You may not use this file except in
2362N/Acompliance with the License.
0N/A
0N/AYou can obtain a copy of the License at
0N/Ahttps://opensso.dev.java.net/public/CDDLv1.0.html or
0N/Aopensso/legal/CDDLv1.0.txt
0N/ASee the License for the specific language governing
0N/Apermission and limitations under the License.
0N/A
0N/AWhen distributing Covered Code, include this CDDL
0N/AHeader Notice in each file and include the License file
0N/Aat opensso/legal/CDDLv1.0.txt.
0N/AIf applicable, add the following below the CDDL Header,
2362N/Awith the fields enclosed by brackets [] replaced by
2362N/Ayour own identifying information:
2362N/A"Portions Copyrighted [year] [name of copyright owner]"
0N/A
0N/A$Id: README,v 1.4 2010/01/11 07:07:44 nithyas Exp $
0N/A
0N/A------------------------------------------------------------------------
0N/A
0N/AThis README explains steps to configure and deploy a REST based sample
0N/Aand secure it using OpenSSO OAuth Token Service.
0N/A
0N/A%% Contents:
0N/A %% 1. Prerequisites
0N/A %% 2. Deploy and configure OpenSSO
0N/A %% 3. Build and deploy the StockService.war
0N/A %% 4. Build and run the Stock Client
0N/A
0N/A%% 1. Prerequisites
0N/AYou must have the following software installed and running to be able
0N/Ato run the sample:
0N/A
0N/AJDK 6 - http://java.sun.com/javase/downloads/index.jsp
GlassFish v2 - https://glassfish.dev.java.net/downloads/v2ur2-b04.html
OpenSSO build 9 - http://opensso.dev.java.net
%% 2. Deploying OpenSSO
Deploy and configure opensso.war using the Glassfish admin console.
% 3. Build and deploy the sample stock service StockService.war
1. cd StockService;
2. copy ./web/WEB-INF/web.xml.template to ./web/WEB-INF/web.xml
edit ./web/WEB-INF/web.xml
change the tags <PROTOCOL>, <HOST>, <PORT> and <DEPLOYURI> to the
protocol, host(FQDN), and port of glassfish server on which the
OpenSSO server is hosted. Save the change.
3. run "ant"
This command creates a StockService.war under dist directory
4. Deploy StockService.war using Glassfish administration console.
% 4. Build and run the sample stock client StockClient.war
1. cd StockClient
2. copy ./src/com/sun/samples/GetQuote.java.template to
./src/com/sun/samples/GetQuote.java
edit ./src/com/sun/samples/GetQuote.java
change the tags <PROTOCOL>, <HOST>, <PORT>, and <DEPLOYURI> to the
protocol, host(FQDN), and port of the glassfish server on which the
OpenSSO server is hosted.
change the tags <PROTOCOL-STOCKSERVICE>, <HOST-STOCKSERVICE>, and
<PORT-STOCKSERVICE> to the protocol, host(FQDN), and port of the
glassfish server on which the sample stock service is hosted.
The OpenSSO OAuth implementation supports all three signature
methods, i.e. HMAC-SHA1, RSA-SHA1, and PLAINTEXT.
By default, this sample uses HMAC-SHA1. You may test
different signature methods from the jsp page.
3. run "ant"
This command creates a StockClient.war under dist directory
4. Deploy StockClient.war using Glassfish administration console.
5. Access the URL
<PROTOCOL-STOCKCLIENT>://<HOST-STOCKCLIENT>:<PORT-STOCKCLIENT>/StockClient
using a browser (replace the tags <PROTOCOL-STOCKCLIENT>,
<HOST-STOCKCLIENT>, and <PORT-STOCKCLIENT> with the protocol,
host(FQDN), and port of the glassfish server on which this sample
stock client is hosted.)
A page diplayed with a text field labelled "Stock Symbol", list box
labelled "Signature Method", and a button "GetQuote".
Enter a valid stock symbol such as JAVA in the text field,
change the signature method, (if required)
and click on the GetQuote button.
The opensso server login page shows and you enter user/password, e.g.
demo/changeit.
After authentication is successful, an OAuth Authorization page is
displayed with the user's uuid and two buttons labelled "Authorize"
and "Revoke".
After clicking on the Authorize button, the stock quote should be
shown in a format similar to the following:
<QuoteResponse>
<Company>Sun Microsystems</Company>
<Symbol>JAVA</Symbol>
<Time>10/14/2009 4:00pm</Time>
<Price>
<Last>9.15</Last>
<Open>9.15</Open>
<DayHigh>9.18</DayHigh>
<DayLow>9.12</DayLow>
<YearRange>9.12</YearRange>
</Price>
<Change>0.00</Change>
<Volume>0.00</Volume>
<MarketCap>0.00</MarketCap>
</QuoteResponse>