========================================================================== README for Weblogic Protected Application Example Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. ========================================================================== ----------------------------------------------------------------------------- INTRODUCTION : The application has bean created to illustrate how to create policy to protect the webapp resources if webapp deployed on wls. ----------------------------------------------------------------------------- CODE ORGANIZATION : The entire package is inside a directory named SampleWebApp. The code organization is as follows : SampleWebApp/ | |----------> Sources : Contains source files for the SampleWebApp Example |----------> build.xml : Contains building and deployment scripts |----------> build.properties : Contains configuration for build.xml |----------> README.txt : The README for SampleWebApp Example. |----------> SampleWebApp.war : This is the WAR file created after the code is built. This is then deployed onto the weblogic server using below mentioned steps. ----------------------------------------------------------------------------- BUILDING INSTRUCTIONS : Source code is provided in the 'Sources' directory. To build the SapleWebApp Example from the source code provided, perform the following operations: From a command line terminal, change directory to the Example Directory. Edit the file build.properties. Change the variable values according to your current environment. NOTE: Set ANT_HOME, JAVA_HOME properly before running ant command. Make sure $ANT_HOME/bin|%ANT_HOME%\bin and $JAVA_HOME/bin|%ANT_HOME%\bin added in PATH Then execute : ant This will build the WAR file for the SampleWebApp Example at location: /SampleWebApp.war ---------------------------------------------------------------------------------------------------- DEPLOYING AND ACCESSING THE EXAMPLE : Pre-requisites : Users are expected to have installed OES11g Admin and created a WLS SM client instance with non-controlled mode. 1. ADD CODE BASE GRANT : Code base grant must be manually applied to ${env.WL_HOME}/server/lib/weblogic.policy. grant codebase "file:/-" { permission oracle.security.jps.service.policystore.PolicyStoreAccessPermission "context=SYSTEM", "*"; permission oracle.security.jps.service.policystore.PolicyStoreAccessPermission "context=APPLICATION,name=*", "*" ; }; 2. ADD OES AUTHORIZATION PROVIDER AND CREATE USER a. Login to console from a WEB browser: e.g. http://myhost:7001/console Add oes authorization provider to the default security realm. If no OESAuthorizationProxy type for create authorization provider, please copy jps-atz-wls-proxyproviders.jar from dirctory mw_home/client_home/modules/oracle.oes.sm_11.1.1/ to ${env.WL_HOME}/server/mbeantypes/ directory and restart. b. Create two users 'teacher' and 'student' in default security realm. 3. DEPLOY AND INVOKE THE SREVLET(SampleWebApp.war) : a. Deploy SampleWebApp.war from the lib directory Please use WebLogic Server Administration Console to deploy the webapp. e.g. Goto http://myhost:7001/console to use the Administration Console for deploying the application Please make sure when deploy this application, the security model should choose "Custom Roles and Policies" b. Invoke the servlet from a WEB browser e.g. http://myhost:7001/SampleWebApp 4. CREATE APPLICATION AND POLICYS Click the link in the default page to create the application and all required policies in the policy store. 5. TYR TO ACCESS THE PROTECTED PAGE Click the "Teacher's page" link or the "Student's page" link try to access the protected page.