14.01.2013 Views

Oracle JHeadstart Developer's Guide - Downloads - Oracle

Oracle JHeadstart Developer's Guide - Downloads - Oracle

Oracle JHeadstart Developer's Guide - Downloads - Oracle

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

10.4. Using JAAS with Custom Login Module for Authentication<br />

10.4.1. Sample Users And Roles<br />

When you run the <strong>JHeadstart</strong> Application Generator with service-level property<br />

Authentication Type set to “JAAS with Custom Login Module”, the following happens:<br />

• A login page and associated login bean is generated. See section Login Page and<br />

Login Bean for more information.<br />

• A logout button and logout bean is generated. See section Logout Button and<br />

Logout Bean for more information.<br />

• J2EE security is set up in the web.xml. See section J2EE Security Set Up in<br />

web.xml for more information.<br />

• The SecurityAminAppDef application definition file is generated. See section<br />

Generating Security Administration Pages for more information.<br />

• SQL script createSampleUsersAndRoles.sql is generated.<br />

Using the default/misc/file.createSampleUsersAndRoles.vm template, launched from<br />

the default/misc/file/fileGenerator.vm template, the SQL script<br />

createSampleUsersAndRoles.sql is generated into the /scripts directory when it does not<br />

exist yet. It is automatically executed as well when service-level property Run Generated<br />

SQL Scripts? is checked. The script creates two users in JHS_USERS table, SKING and<br />

AHUNOLD, two roles in JHS_ROLES table, the administrator role as specified in the<br />

Administrator Role property, and the user role as specified in the User Role property.<br />

SKING is assigned the administrator role, AHUNOLD the user role through two entries<br />

in the JHS_USER_ROLE_GRANTS table.<br />

10.4.2. Configuring the Custom Login Module<br />

Unlike other security settings, using a JAAS Custom Login Module requires additional<br />

manual steps from you, the developer, before you can run your application using the<br />

embedded OC4J. The embedded OC4J is configured differently than the standalone<br />

OC4J to support runtime testing of applications without requiring application<br />

deployment. To do this, all web applications are executed as "current-workspace-app",<br />

no matter what the assigned name for the J2EE application. This information is<br />

important because to use JAAS Login Modules with the embedded OC4J, they need to be<br />

configured under the name of the application using it: current-workspace-app. Failing to<br />

use the current-workspace-app name for the LoginModule will cause OC4J to use its<br />

own default Realm LoginModule and look for the username / password pair in the<br />

system-jazn-data.xml file directly. Thus, failing to find login credentials would end in an<br />

unauthenticated request.<br />

All configuration files of the embedded OC4J are located in the<br />

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!