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