1 Reply Latest reply on Jan 30, 2012 10:29 AM by Bernard Labno

    how to use seam-security with seam-remoting

    mi haisheng Newbie
      i find a login example in seam-booking.i paste main code here.
      this exmple is for JSF.
      ---------------------
      <h:form id="login" rendered="#{not identity.loggedIn}">
                  <fieldset>
                      <div>
                          <h:outputLabel for="username" value="#{bundles.messages.home_usernameLabel}"/>
                          <h:inputText id="username" value="#{credentials.username}" style="width: 175px;"/>
                          <div class="errors">
                              <h:message for="username"/>
                          </div>
                      </div>
                      <div>
                          <h:outputLabel for="password" value="#{bundles.messages.home_passwordLabel}"/>
                          <h:inputSecret id="password" value="#{credentials.password}" style="width: 175px;"/>
                      </div>
      ......
      -------------------
      -------------------
      class BookingAuthenticator
      ...
          public void authenticate() {
              log.info("Logging in " + credentials.getUsername());
              if ((credentials.getUsername() == null) || (credentials.getCredential() == null)) {
                  messages.error(new DefaultBundleKey("identity_loginFailed")).defaults("Invalid username or password");
                  setStatus(AuthenticationStatus.FAILURE);
              }
              User user = em.find(User.class, credentials.getUsername());
              if (user != null && credentials.getCredential() instanceof PasswordCredential &&
                  user.getPassword().equals(((PasswordCredential) credentials.getCredential()).getValue())) {
                  loginEventSrc.fire(user);
                  messages.info(new DefaultBundleKey("identity_loggedIn"), user.getName()).defaults("You're signed in as {0}")
                          .params(user.getName());
                  setStatus(AuthenticationStatus.SUCCESS);
                  setUser(new SimpleUser(user.getUsername())); //TODO confirm the need for this set method
                  return;
              }

              messages.error(new DefaultBundleKey("identity_loginFailed")).defaults("Invalid username or password");
              setStatus(AuthenticationStatus.FAILURE);
          }
      ...
      -----------------------

      i want to use seam-remoting instead of JSF.so,my question is how to use seam-security with seam-remoting????