<?xml version="1.0"?>
<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  ~ JBoss, a division of Red Hat                                              ~
  ~ Copyright 2006, Red Hat Middleware, LLC, and individual                   ~
  ~ contributors as indicated by the @authors tag. See the                    ~
  ~ copyright.txt in the distribution for a full listing of                   ~
  ~ individual contributors.                                                  ~
  ~                                                                           ~
  ~ This is free software; you can redistribute it and/or modify it           ~
  ~ under the terms of the GNU Lesser General Public License as               ~
  ~ published by the Free Software Foundation; either version 2.1 of          ~
  ~ the License, or (at your option) any later version.                       ~
  ~                                                                           ~
  ~ This software is distributed in the hope that it will be useful,          ~
  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of            ~
  ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU          ~
  ~ Lesser General Public License for more details.                           ~
  ~                                                                           ~
  ~ You should have received a copy of the GNU Lesser General Public          ~
  ~ License along with this software; if not, write to the Free               ~
  ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA        ~
  ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.                  ~
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->

<!DOCTYPE faces-config PUBLIC
   "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN"
   "http://java.sun.com/dtd/web-facesconfig_1_0.dtd">

<faces-config>

   <application>
      <variable-resolver>org.jboss.portal.core.identity.ui.faces.PortletVariableResolver</variable-resolver>
		<property-resolver>org.jboss.portal.core.identity.ui.faces.PortletDelegatingPropertyResolver</property-resolver>
      <view-handler>
            org.jboss.portletbridge.application.PortletViewHandler
      </view-handler>
      <state-manager>org.jboss.portletbridge.application.PortletStateManager</state-manager>
      <locale-config>
         <default-locale>en</default-locale>
         <supported-locale>it</supported-locale>
         <supported-locale>ru</supported-locale>
         <supported-locale>ja</supported-locale>
         <supported-locale>pt_BR</supported-locale>
         <supported-locale>fr</supported-locale>
      </locale-config>
      <message-bundle>conf.bundles.Identity</message-bundle>
   </application>
   
	<managed-bean>
		<managed-bean-name>configurationbean</managed-bean-name>
		<managed-bean-class>org.jboss.portal.core.identity.ui.common.ConfigurationBean</managed-bean-class>
		<managed-bean-scope>application</managed-bean-scope>
		<managed-property>
			<property-name>identityUIConfigurationService</property-name>
			<value>#{applicationScope.IdentityUIConfigurationService}</value>
		</managed-property>
	</managed-bean>
	<managed-bean>
		<managed-bean-name>metadataservice</managed-bean-name>
		<managed-bean-class>org.jboss.portal.core.identity.ui.common.MetaDataServiceBean</managed-bean-class>
		<managed-bean-scope>application</managed-bean-scope>
	</managed-bean>
	<managed-bean>
		<managed-bean-name>identityrolemgr</managed-bean-name>
		<managed-bean-class>org.jboss.portal.core.identity.ui.common.IdentityRoleBean</managed-bean-class>
		<managed-bean-scope>application</managed-bean-scope>
		<managed-property>
			<property-name>roleModule</property-name>
			<value>#{applicationScope.RoleModule}</value>
		</managed-property>
		<managed-property>
			<property-name>membershipModule</property-name>
			<value>#{applicationScope.MembershipModule}</value>
		</managed-property>
	</managed-bean>
	<managed-bean>
		<managed-bean-name>identityusermgr</managed-bean-name>
		<managed-bean-class>org.jboss.portal.core.identity.ui.common.IdentityUserBean</managed-bean-class>
		<managed-bean-scope>application</managed-bean-scope>
		<managed-property>
			<property-name>userModule</property-name>
			<value>#{applicationScope.UserModule}</value>
		</managed-property>
		<managed-property>
			<property-name>userProfileModule</property-name>
			<value>#{applicationScope.UserProfileModule}</value>
		</managed-property>
		<managed-property>
			<property-name>metaDataService</property-name>
			<value>#{metadataservice}</value>
		</managed-property>
	</managed-bean>

	<managed-bean>
		<managed-bean-name>editprofilemgr</managed-bean-name>
		<managed-bean-class>org.jboss.portal.core.identity.ui.actions.EditProfileAction</managed-bean-class>
		<managed-bean-scope>session</managed-bean-scope>
		<managed-property>
			<property-name>identityUserBean</property-name>
			<value>#{identityusermgr}</value>
		</managed-property>
		<managed-property>
			<property-name>validateEmailService</property-name>
			<value>#{applicationScope.ValidateEmailService}</value>
		</managed-property>
	</managed-bean>
	<managed-bean>
		<managed-bean-name>userregistermgr</managed-bean-name>
		<managed-bean-class>org.jboss.portal.core.identity.ui.actions.CreateUserAction</managed-bean-class>
		<managed-bean-scope>session</managed-bean-scope>
		<managed-property>
			<property-name>identityUserBean</property-name>
			<value>#{identityusermgr}</value>
		</managed-property>
		<managed-property>
			<property-name>defaultRoles</property-name>
			<value>#{configurationbean.configuration.defaultRoles}</value>
		</managed-property>
		<managed-property>
			<property-name>registrationService</property-name>
			<value>#{applicationScope.RegistrationService}</value>
		</managed-property>
	</managed-bean>
	<managed-bean>
		<managed-bean-name>assignrolemgr</managed-bean-name>
		<managed-bean-class>org.jboss.portal.core.identity.ui.actions.AssignRoleAction</managed-bean-class>
		<managed-bean-scope>session</managed-bean-scope>
		<managed-property>
			<property-name>identityUserBean</property-name>
			<value>#{identityusermgr}</value>
		</managed-property>
		<managed-property>
			<property-name>identityRoleBean</property-name>
			<value>#{identityrolemgr}</value>
		</managed-property>
	</managed-bean>   
	<managed-bean>
		<managed-bean-name>useradministrationbean</managed-bean-name>
		<managed-bean-class>org.jboss.portal.core.identity.ui.admin.UserAdministrationBean</managed-bean-class>
		<managed-bean-scope>session</managed-bean-scope>
		<managed-property>
			<property-name>subscriptionMode</property-name>
			<value>#{configurationbean.configuration.subscriptionMode}</value>
		</managed-property>
		<managed-property>
			<property-name>adminSubscriptionMode</property-name>
			<value>#{configurationbean.configuration.adminSubscriptionMode}</value>
		</managed-property>
		<managed-property>
			<property-name>identityUserBean</property-name>
			<value>#{identityusermgr}</value>
		</managed-property>
		<managed-property>
			<property-name>identityRoleBean</property-name>
			<value>#{identityrolemgr}</value>
		</managed-property>
		<managed-property>
			<property-name>registrationService</property-name>
			<value>#{applicationScope.RegistrationService}</value>
		</managed-property>
	</managed-bean>
	<managed-bean>
		<managed-bean-name>rolemanagementbean</managed-bean-name>
		<managed-bean-class>org.jboss.portal.core.identity.ui.admin.RoleManagementBean</managed-bean-class>
		<managed-bean-scope>session</managed-bean-scope>
		<managed-property>
			<property-name>identityRoleBean</property-name>
			<value>#{identityrolemgr}</value>
		</managed-property>
	</managed-bean>
	<managed-bean>
		<managed-bean-name>editrolemgr</managed-bean-name>
		<managed-bean-class>org.jboss.portal.core.identity.ui.actions.EditRoleAction</managed-bean-class>
		<managed-bean-scope>session</managed-bean-scope>
		<managed-property>
			<property-name>identityRoleBean</property-name>
			<value>#{identityrolemgr}</value>
		</managed-property>
	</managed-bean>
	<managed-bean>
		<managed-bean-name>lostpasswordmgr</managed-bean-name>
		<managed-bean-class>org.jboss.portal.core.identity.ui.actions.LostPasswordAction</managed-bean-class>
		<managed-bean-scope>request</managed-bean-scope>
		<managed-property>
			<property-name>passwordCharacters</property-name>
			<value>#{configurationbean.configuration.passwordGenerationCharacters}</value>
		</managed-property>
		<managed-property>
			<property-name>identityUserBean</property-name>
			<value>#{identityusermgr}</value>
		</managed-property>
		<managed-property>
			<property-name>identityMailService</property-name>
			<value>#{applicationScope.IdentityMailService}</value>
		</managed-property>
	</managed-bean>
	<managed-bean>
		<managed-bean-name>createrolemgr</managed-bean-name>
		<managed-bean-class>org.jboss.portal.core.identity.ui.actions.CreateRoleAction</managed-bean-class>
		<managed-bean-scope>request</managed-bean-scope>
		<managed-property>
			<property-name>identityRoleBean</property-name>
			<value>#{identityrolemgr}</value>
		</managed-property>
	</managed-bean>
   
	<validator>
		<validator-id>EmailValidator</validator-id>	
		<validator-class>org.jboss.portal.core.identity.ui.validators.EmailValidator</validator-class>
	</validator>
	<validator>
		<validator-id>UsernameValidator</validator-id>	
		<validator-class>org.jboss.portal.core.identity.ui.validators.UsernameValidator</validator-class>
	</validator>
   <validator>
      <validator-id>RoleValidator</validator-id>  
      <validator-class>org.jboss.portal.core.identity.ui.validators.RoleValidator</validator-class>
   </validator>
	<validator>
		<validator-id>PasswordValidator</validator-id>	
		<validator-class>org.jboss.portal.core.identity.ui.validators.PasswordValidator</validator-class>
	</validator>
	<validator>
		<validator-id>CurrentPasswordValidator</validator-id>	
		<validator-class>org.jboss.portal.core.identity.ui.validators.CurrentPasswordValidator</validator-class>
	</validator>
	<validator>
		<validator-id>CaptchaValidator</validator-id>	
		<validator-class>org.jboss.portal.core.identity.ui.validators.CaptchaValidator</validator-class>
	</validator>
   
	<navigation-rule>
		<navigation-case>
			<from-outcome>start</from-outcome>
			<to-view-id>/jsf/index.xhtml</to-view-id>
		</navigation-case>
	</navigation-rule>
	<navigation-rule>
		<navigation-case>
			<from-outcome>lostPassword</from-outcome>
			<to-view-id>/jsf/lostPassword/lost.xhtml</to-view-id>
		</navigation-case>
	</navigation-rule>
	<navigation-rule>
		<from-view-id>/jsf/lostPassword/lost.xhtml</from-view-id>
		<navigation-case>
			<from-outcome>status</from-outcome>
			<to-view-id>/jsf/lostPassword/status.xhtml</to-view-id>
		</navigation-case>
	</navigation-rule>
	<navigation-rule>
		<navigation-case>
			<from-outcome>register</from-outcome>
			<to-view-id>/jsf/register/register.xhtml</to-view-id>
		</navigation-case>
	</navigation-rule>
	<navigation-rule>
		<from-view-id>/jsf/register/register.xhtml</from-view-id>
		<navigation-case>
			<from-outcome>register</from-outcome>
			<to-view-id>/jsf/register/confirm.xhtml</to-view-id>
		</navigation-case>
	</navigation-rule>
	<navigation-rule>
		<from-view-id>/jsf/register/confirm.xhtml</from-view-id>
		<navigation-case>
			<from-outcome>revise</from-outcome>
			<to-view-id>/jsf/register/register.xhtml</to-view-id>
		</navigation-case>
		<navigation-case>
			<from-outcome>registered</from-outcome>
			<to-view-id>/jsf/register/success.xhtml</to-view-id>
		</navigation-case>
	</navigation-rule>
	<navigation-rule>
		<navigation-case>
			<from-outcome>changePassword</from-outcome>
			<to-view-id>/jsf/profile/changePassword.xhtml</to-view-id>
		</navigation-case>
	</navigation-rule>
	<navigation-rule>
		<from-view-id>/jsf/profile/changePassword.xhtml</from-view-id>
		<navigation-case>
			<from-outcome>status</from-outcome>
			<to-view-id>/jsf/profile/viewProfile.xhtml</to-view-id>
		</navigation-case>
	</navigation-rule>
	<navigation-rule>
		<navigation-case>
			<from-outcome>changeEmail</from-outcome>
			<to-view-id>/jsf/profile/changeEmail.xhtml</to-view-id>
		</navigation-case>
	</navigation-rule>
	<navigation-rule>
		<from-view-id>/jsf/profile/changeEmail.xhtml</from-view-id>
		<navigation-case>
			<from-outcome>status</from-outcome>
			<to-view-id>/jsf/profile/viewProfile.xhtml</to-view-id>
		</navigation-case>
	</navigation-rule>
	<navigation-rule>
		<from-view-id>/jsf/index.xhtml</from-view-id>
		<navigation-case>
			<from-outcome>editProfile</from-outcome>
			<to-view-id>/jsf/profile/editProfileRedirect.xhtml</to-view-id>
		</navigation-case>
	</navigation-rule>
	<navigation-rule>
		<from-view-id>/jsf/profile/*</from-view-id>
		<navigation-case>
			<from-outcome>editProfile</from-outcome>
			<to-view-id>/jsf/profile/editProfileRedirect.xhtml</to-view-id>
		</navigation-case>
	</navigation-rule>
   
	<navigation-rule>
		<from-view-id>/jsf/admin/*</from-view-id>
		<navigation-case>
			<from-outcome>userAdmin</from-outcome>
			<to-view-id>/jsf/admin/index.xhtml</to-view-id>
		</navigation-case>
		<navigation-case>
			<from-outcome>start</from-outcome>
			<to-view-id>/jsf/admin/index.xhtml</to-view-id>
		</navigation-case>
	</navigation-rule>
	<navigation-rule>
		<from-view-id>/jsf/admin/*</from-view-id>
		<navigation-case>
			<from-outcome>roleAdmin</from-outcome>
			<to-view-id>/jsf/admin/roles.xhtml</to-view-id>
		</navigation-case>
	</navigation-rule>  
	<navigation-rule>
		<from-view-id>/jsf/admin/index.xhtml</from-view-id>
		<navigation-case>
			<from-outcome>createUser</from-outcome>
			<to-view-id>/jsf/admin/user/createUser.xhtml</to-view-id>
		</navigation-case>
	</navigation-rule>
	<navigation-rule>
		<from-view-id>/jsf/admin/*</from-view-id>
		<navigation-case>
			<from-outcome>searchUsers</from-outcome>
			<to-view-id>/jsf/admin/user/searchUsers.xhtml</to-view-id>
		</navigation-case>
	</navigation-rule>
	<navigation-rule>
		<from-view-id>/jsf/admin/index.xhtml</from-view-id>
		<navigation-case>
			<from-outcome>showPendingUsers</from-outcome>
			<to-view-id>/jsf/admin/user/pendingUsers.xhtml</to-view-id>
		</navigation-case>
	</navigation-rule>
	<navigation-rule>
		<from-view-id>/jsf/admin/user/pendingUsers.xhtml</from-view-id>
		<navigation-case>
			<from-outcome>confirmPendingAction</from-outcome>
			<to-view-id>/jsf/admin/user/confirmPendingAction.xhtml</to-view-id>
		</navigation-case>
		<navigation-case>
			<from-outcome>cancel</from-outcome>
			<to-view-id>/jsf/admin/index.xthml</to-view-id>
		</navigation-case>
	</navigation-rule>
	<navigation-rule>
		<from-view-id>/jsf/admin/user/confirmPendingAction.xhtml</from-view-id>
		<navigation-case>
			<from-outcome>revise</from-outcome>
			<to-view-id>/jsf/admin/user/pendingUsers.xhtml</to-view-id>
		</navigation-case>
		<navigation-case>
			<from-outcome>success</from-outcome>
			<to-view-id>/jsf/admin/index.xthml</to-view-id>
		</navigation-case>
	</navigation-rule>
	<navigation-rule>
		<from-view-id>/jsf/admin/user/searchUsers.xhtml</from-view-id>
		<navigation-case>
			<from-outcome>deleteUser</from-outcome>
			<to-view-id>/jsf/admin/user/deleteUser.xhtml</to-view-id>
		</navigation-case>
	</navigation-rule>
	<navigation-rule>
		<from-view-id>/jsf/admin/editProfile.xhtml</from-view-id>
		<navigation-case>
			<from-outcome>adminChangePassword</from-outcome>
			<to-view-id>/jsf/admin/user/changePassword.xhtml</to-view-id>
		</navigation-case>
		<navigation-case>
			<from-outcome>start</from-outcome>
			<to-view-id>/jsf/admin/user/searchUsers.xhtml</to-view-id>
		</navigation-case>
	</navigation-rule>
	<navigation-rule>
		<from-view-id>/jsf/admin/*</from-view-id>
		<navigation-case>
			<from-outcome>start</from-outcome>
			<to-view-id>/jsf/admin/user/searchUsers.xhtml</to-view-id>
		</navigation-case>
	</navigation-rule>
	<navigation-rule>
		<from-view-id>/jsf/admin/*</from-view-id>
		<navigation-case>
			<from-action>#{editprofilemgr.adminEditProfile}</from-action>
			<from-outcome>editProfile</from-outcome>
			<to-view-id>/jsf/admin/editProfile.xhtml</to-view-id>
		</navigation-case>
	</navigation-rule>
	<navigation-rule>
		<from-view-id>/jsf/admin/*</from-view-id>
		<navigation-case>
			<from-action>#{assignrolemgr.assignRoles}</from-action>
			<from-outcome>assignRoles</from-outcome>
			<to-view-id>/jsf/admin/assignRoles.xhtml</to-view-id>
		</navigation-case>
	</navigation-rule>
	<navigation-rule>
		<from-view-id>/jsf/admin/user/createUser.xhtml</from-view-id>
		<navigation-case>
			<from-outcome>register</from-outcome>
			<to-view-id>/jsf/admin/user/registerRoles.xhtml</to-view-id>
		</navigation-case>
	</navigation-rule>       
	<navigation-rule>
		<from-view-id>/jsf/admin/user/registerRoles.xhtml</from-view-id>
		<navigation-case>
			<from-outcome>register</from-outcome>
			<to-view-id>/jsf/admin/user/registerConfirm.xhtml</to-view-id>
		</navigation-case>
	</navigation-rule>    
	<navigation-rule>
		<from-view-id>/jsf/admin/user/registerConfirm.xhtml</from-view-id>
		<navigation-case>
			<from-outcome>revise</from-outcome>
			<to-view-id>/jsf/admin/user/createUser.xhtml</to-view-id>
		</navigation-case>
		<navigation-case>
			<from-outcome>registered</from-outcome>
			<to-view-id>/jsf/admin/index.xhtml</to-view-id>
		</navigation-case>
	</navigation-rule>
	<navigation-rule>
		<from-view-id>/jsf/admin/roles.xhtml</from-view-id>
		<navigation-case>
			<from-outcome>createRole</from-outcome>
			<to-view-id>/jsf/admin/roles/createRole.xhtml</to-view-id>
		</navigation-case>
	</navigation-rule>
	<navigation-rule>
		<from-view-id>/jsf/admin/roles.xhtml</from-view-id>
		<navigation-case>
			<from-outcome>editRole</from-outcome>
			<to-view-id>/jsf/admin/roles/editRole.xhtml</to-view-id>
		</navigation-case>
	</navigation-rule>
	<navigation-rule>
		<from-view-id>/jsf/admin/roles.xhtml</from-view-id>
		<navigation-case>
			<from-outcome>viewMembers</from-outcome>
			<to-view-id>/jsf/admin/roles/roleMembers.xhtml</to-view-id>
		</navigation-case>
	</navigation-rule>
	<navigation-rule>
		<from-view-id>/jsf/admin/roles.xhtml</from-view-id>
		<navigation-case>
			<from-outcome>deleteRole</from-outcome>
			<to-view-id>/jsf/admin/roles/deleteRole.xhtml</to-view-id>
		</navigation-case>
	</navigation-rule>   
	<navigation-rule>
		<from-view-id>/jsf/admin/editProfile.xhtml</from-view-id>
		<navigation-case>
			<from-outcome>resetPassword</from-outcome>
			<to-view-id>/jsf/admin/user/resetPassword.xhtml</to-view-id>
		</navigation-case>
	</navigation-rule>
	<navigation-rule>
		<from-view-id>/jsf/admin/user/resetPassword.xhtml</from-view-id>
		<navigation-case>
			<from-action>#{lostpasswordmgr.doomed}</from-action>
   			<from-outcome>status</from-outcome>
   			<to-view-id>/jsf/admin/user/searchUsers.xhtml</to-view-id>
   		</navigation-case>
   		<navigation-case>
   			<from-action>#{lostpasswordmgr.doomed}</from-action>
   			<from-outcome>lostPassword</from-outcome>
   			<to-view-id>/jsf/admin/editProfile.xhtml</to-view-id>
		</navigation-case>
	</navigation-rule>
	<navigation-rule>
		<from-view-id>/jsf/admin/user/changePassword.xhtml</from-view-id>
		<navigation-case>
			<from-outcome>status</from-outcome>
			<to-view-id>/jsf/admin/user/searchUsers.xhtml</to-view-id>
		</navigation-case>
		<navigation-case>
			<from-outcome>searchUsers</from-outcome>
			<to-view-id>/jsf/admin/user/searchUsers.xhtml</to-view-id>
		</navigation-case>
	</navigation-rule>
   
</faces-config>
