3 Replies Latest reply on Oct 28, 2008 3:35 PM by Val Sw

    Process for disabling Login, steps to take care

    Val Sw Expert
      Hi,

      I have generated CRUD application using seam generate-ui, it looks great....

      However, I would like to know correct process to disable logging functionality, example whenever I try to create it asks for login.

      I am doing the following to disable logging, please check if it is correct as per seam framework and what else I should change..

      a) components.xml
      Comment the following:
      ----------------------
      <drools:rule-base name="securityRules">
         <drools:rule-files>
              <value>/security.drl</value>
         </drools:rule-files>
      </drools:rule-base>

      <security:identity security-rules="#{securityRules}" authenticate-method="#{authenticator.authenticate}" remember-me="true"/>

      <event type="org.jboss.seam.security.notLoggedIn">
         <action execute="#{redirect.captureCurrentView}"/>
      </event>
      <event type="org.jboss.seam.security.loginSuccessful">
         <action execute="#{redirect.returnToCapturedView}"/>
      </event>

      b) xxxxEdit.page.xml
      These files were generated by seam generate-ui, I should change to login-required="false"

      example StudyEdit.page.xml
      <?xml version="1.0" encoding="UTF-8"?>
      <page xmlns="http://jboss.com/products/seam/pages"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://jboss.com/products/seam/pages http://jboss.com/products/seam/pages-2.0.xsd"
        no-conversation-view-id="/StudyList.xhtml"
        login-required="true">

      <begin-conversation join="true"/>
      <action execute="#{studyHome.wire}"/>
      ......
        • 1. Re: Process for disabling Login, steps to take care
          Val Sw Expert
          Please suggest on the above requset when I use login-required="false" in XXXX.page.xml as in point (b) above, sometimes it still asks for log-in.

          Please suggest the steps and changes I should do to so that user is never asked for login.

          Thanks
          • 2. Re: Process for disabling Login, steps to take care
            Ingo Jobling Master

            Try calling the static method Identity.setSecurityEnabled(false) to disable security checks

            • 3. Re: Process for disabling Login, steps to take care
              Val Sw Expert
              Where should I call this method, will it be home class...

              This is sample home for Reagent entity.. pls suggest


              @Name("reagentHome")
              public class ReagentHome extends EntityHome<Reagent> {

                   @In(create = true)
                   TreatmentHome treatmentHome;

                   public void setReagentHjid(Long id) {
                        setId(id);
                   }

                   public Long getReagentHjid() {
                        return (Long) getId();
                   }

                   @Override
                   protected Reagent createInstance() {
                        Reagent reagent = new Reagent();
                        return reagent;
                   }

                   public void wire() {
                        getInstance();
                        Treatment treatment = treatmentHome.getDefinedInstance();
                        if (treatment != null) {
                             getInstance().setTreatment(treatment);
                        }
                   }

                   public boolean isWired() {
                        return true;
                   }

                   public Reagent getDefinedInstance() {
                        return isIdDefined() ? getInstance() : null;
                   }

              }