1 2 Previous Next 20 Replies Latest reply on Feb 12, 2007 7:53 PM by henrik.lindberg Go to original post
      • 15. Re: Exception for authorization attempt
        shane.bryzak

        One other important thing to note - the following rule doesn't require the user to be logged in (there is no role check in the conditions) - the permission will be granted no matter what:

        canUserRenderSettings
         no-loop
         activation-group "permissions"
        when
         c: PermissionCheck(name == "/settings.xhtml" || "settings", action == "render", granted == false)
        then
         c.grant();
         modify(c);
        end;
        


        • 16. Re: Exception for authorization attempt
          henrik.lindberg

          ok thanks - I wondered about that - now I know. Will add that.

          Also made an attempt to build from CVS (which worked fine), but I did not figure out how to use what was built instead of the 1.1.5.GA I am using in my project. So, I continued with other things for the time being.

          Any pointer or suggestion on how to "build from CVS and get it into your project so you can test the latest and greates against your code" ?

          • 17. Re: Exception for authorization attempt
            shane.bryzak

             

            "henrik.lindberg" wrote:

            Any pointer or suggestion on how to "build from CVS and get it into your project so you can test the latest and greates against your code" ?



            It should just be a matter of replacing the seam jars with the ones that you build from cvs.

            • 18. Re: Exception for authorization attempt
              henrik.lindberg

              Thanks,
              I tried that. It sort of worked, but I ran into problems since there was some change in how Indentity.authorize is used - I think I read something about that in a forum topic, but then I ran out of time.

              Will get back to that a little later.

              • 19. Re: Exception for authorization attempt
                shane.bryzak

                Yes, the authentication method changed. You now need to provide a method that takes no parameters (instead of the three it expected before) but still returns a boolean. The parameters were removed in favor of directly manipulating the identity instead - here's the example from the docs:

                @Name("authenticator")
                public class Authenticator {
                 @In EntityManager entityManager;
                 public boolean authenticate() {
                 try
                 {
                 User user = (User) entityManager.createQuery(
                 "from User where username = :username and password = :password")
                 .setParameter("username", Identity.instance().getUsername())
                 .setParameter("password", Identity.instance().getPassword())
                 .getSingleResult();
                
                 if (user.getRoles() != null)
                 {
                 for (UserRole mr : user.getRoles())
                 Identity.instance().addRole(mr.getName());
                 }
                
                 return true;
                 }
                 catch (NoResultException ex)
                 {
                 FacesMessages.instance().add("Invalid username/password");
                 return false;
                 }
                 }
                


                • 20. Re: Exception for authorization attempt
                  henrik.lindberg

                  I have now upgraded to 1.1.6.GA and this works fine.

                  1 2 Previous Next