Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Correction of typo

...

  1. Take reference from ExampleMenus.xml file for having login and logout options in your menu.
    Targets for these options will be available from "component://common/webcommon/WEB-INF/common-controller.xml", which we have to include in our controller.xml.
    or you can do these entries in your controller.xml file under
    Code Block
    <!- Request Mappings ->
    <!-- Security Mappings -->
     <request-map uri="checkLogin" edit="false">
        <description>Verify a user is logged in.</description>
            <security https="true" auth="false"/>
            <event type="java" path="org.ofbiz.webapp.control.LoginWorker" invoke="checkLogin" />
            <response name="success" type="view" value="main"/>
            <response name="error" type="view" value="login"/>
        </request-map>
        <request-map uri="login">
            <security https="true" auth="false"/>
            <event type="java" path="org.ofbiz.webapp.control.LoginW../../../framework/exampleext/webapp/exampleext/WEB-INF/web.xmlorkerLoginWorker" invoke="login"/>
            <response name="success" type="view" value="main"/>
            <response name="error" type="view" value="login"/>
        </request-map>
        <request-map uri="logout">
            <security https="true" auth="true"/>
            <event type="java" path="org.ofbiz.webapp.control.LoginWorker" invoke="logout"/>
            <response name="success" type="request" value="checkLogin"/>
            <response name="error" type="view" value="main"/>
        </request-map>
    
    These requests are needed to add in your controller only when you have not included any of the other component controller which consist of these requests. So if you have already included common-controller.xml file then you don't need to explicitly do these entries in your controller.    
    and the same view we have in place can be used for which we have entry in common-controller.xml file we can also have our own:
    Code Block
    <view-map name="login" type="screen" page="component://common/widget/CommonScreens.xml#login"/>
    
  2. Make changes in requests in controller.xml file make auth="true" means now these requests needs authentication.
    This is first security level which you have implemented. you request should look like :
    Code Block
    <request-map uri="main">
        <security https="true" auth="true"/>
        <response name="success" type="view" value="main"/>
        <response name="error" type="view" value="main"/>
    </request-map>
    
    Now run your application and observe the difference. you can login by user name : admin and pwd: ofbizHere we should understand why we had given the permission "OFBTOOLS" in base-permission in ofbiz-component.xml file. To understand this please read following carefully and perform steps as mentioned:
    Confirm that user 'admin' has the 'OFBTOOLS' permission.
    1. Login into partymanager to confirm that the user admin has the required permission https://127.0.0.1:8443/partymgr/control/main
    2. Once your logged in search for the user by typing 'admin' in the User Login field and then clicking the Lookup Party button.
    3.    This does a wild char*  search and you should see multiple users returned.Click the 'Details' button for the admin user.
      Note : Important point to note here is that the person 'Mr. THE PRIVILEGED ADMINISTRATOR' has a partyId admin has multiple login Ids as listed in the
      User Name(s) form.
    4. We interested in the admin user login so click on the 'Security Groups' button and confirm that the use 'admin' is part of the 'FULLADMIN' group. The Groups that the user belongs to is shown in the bottom list form Drill down on the FULLADMIN.
    5. Click on the Permissions tab. This tab shows all the permissions for the FULLADMIN security group. Navigate between the permissions till you find the OFBTOOLS permissions.
      'OFBTOOLS_VIEW Permission to access the Stock OFBiz Manager Applications.' This confirms that the userlogin 'admin' has the permission 'OFBTOOLS'
    6. Take a moment  to review the entity model as it relates to users and permissions. The arrow represents the many side of the relationship.An really important reading at this moment is at : OFBiz Security

...