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.5.3. Login Page and Login Bean<br />

10.5.4. Logout Button<br />

An ADF Faces login page is generated in /security/pages subdirectory under the html<br />

root directory. This file is generated through the default/misc/file/fileGenerator.vm<br />

template, which in turn uses default/misc/file/loginPage.vm template. The login page<br />

is only generated when it does not exist yet, so you can customize the generated login<br />

page without loosing these changes when regenerating.<br />

When clicking the login button on the login page, the authenticateUser method of<br />

the generic oracle.jheadstart.controller.jsf.bean.LoginBean class is<br />

called. This bean is configured in JhsCommonBeans.xml. In case of custom<br />

authentication, this method calls method authenticateUser(String username,<br />

String password) on the nested JhsModelService application module. This method<br />

uses a ViewObject to access the JHS_USERS table to validate the username and<br />

password. When valid, the method returns the UserContext object that implements the<br />

JhsUser interface. This object is stored on the session using “JhsUser” as key, which is<br />

checked by the authentication filter to determine whether the user is already logged in.<br />

The generated login page contains two “fast login” links for users SKING and<br />

AHUNOLD, the two sample users that are created in SQL script<br />

createSampleUsersAndRoles.sql.<br />

Using the /default/misc/file/menuGlobal.vm template, called from the<br />

default/misc/file/fileGenerator.vm template, a logout button is generated in the global<br />

buttons area. When clicking the logout button, you navigate to a non-existent page using<br />

the URI /faces/security/pages/Logout.jspx. However, this URI is configured in the<br />

<strong>JHeadstart</strong> Authentication filter as the logout URL, see section <strong>JHeadstart</strong> Authentication<br />

Filter for more information.<br />

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

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

Saved successfully!

Ooh no, something went wrong!