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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

10.8. Using Your Own Security Tables<br />

You can use your own security tables rather than the <strong>JHeadstart</strong> tables, if you prefer so.<br />

The <strong>JHeadstart</strong> runtime includes predefined “hooks” where you can plug in your own<br />

security code to access your own security tables. The hooks to use depend on your<br />

security settings, as described in the next sections<br />

10.8.1. Changes when Using JAAS Custom Login Module<br />

Using your own security tables instead of the <strong>JHeadstart</strong> tables and view is easiest when<br />

using a JAAS custom login module: just change the options of the <br />

element to reference your own table and column names. Consider creating a database<br />

view like JHS_USER_ROLE_INFO if your security data model does not comply with the<br />

prerequisites of your custom login module provider.<br />

10.8.2. Changes when Using Custom Authentication<br />

When you use custom authentication, the authenticateUser method of the nested<br />

JhsModelService application module is called. To hook in your own authentication logic,<br />

you should perform the following steps:<br />

• Create your own application module that extends JhsModelService application<br />

module.<br />

• Add the view object needed to authenticate the user against your own table.<br />

• In this application module, override method authenticateUser and perform<br />

authentication using the view object created in the previous step<br />

• Remove the JhsModelService as nested usage from your root application module<br />

• Add your extended version of JhsModelService application module as nested<br />

usage to your root application module, and make sure the instance name is set<br />

to JhsModelService.<br />

10.8.3. Changes when Using Custom Authorization and/or Permissions<br />

The <strong>JHeadstart</strong> Authorization Proxy makes use of method<br />

createUserContext(String username, String userDisplayName, boolean<br />

addPermissionForJAASRoles)<br />

on the nested JhsModelService application module. This method creates a user context<br />

object that implements the JhsUser interface, and adds authorized custom roles and<br />

permissions by calling method setRolesAndPermissions on the same<br />

JhsModelService application module.<br />

So, to use your own tables for role and permission information, it is sufficient to override<br />

method setRolesAndPermissions. Override this method in your own application module<br />

that extends JhsModelService, and replace the nested JhsModelService instance with<br />

your subclass.<br />

10 - 26 Application Security <strong>JHeadstart</strong> Developer’s <strong>Guide</strong>

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

Saved successfully!

Ooh no, something went wrong!