[jboss-user] [JBoss Seam] - Re: Unable to authenticate in 1.1.7RC1 : is it a regression?

alex.kozlenkov do-not-reply at jboss.com
Mon Feb 26 08:59:28 EST 2007


Thanks for this help. It works now with the code below:	public boolean authenticate() {
  | 		try {
  | 			User user0 = (User) entityManager.createQuery(
  | 					"from User where username = :username")
  | 					.setParameter("username", Identity.instance().getUsername())
  | 					.getSingleResult();
  | 			if ( !compareHash( user0.getHashedPassword(), Identity.instance().getPassword() ) )
  | 			{
  | 	         return false;
  | 			}
  | 
  | 			user = user0;
  | 			
  | 			if( user.getRoles() != null ) {
  | 				for (UserRole r : user.getRoles())
  | 					Identity.instance().addRole(r.getName());
  | 			}
  | 			return true;
  | 		}
  | 		catch (NoResultException ex) {
  | 			log.warn("Invalid username/password");
  | 			return false;
  | 		}
  | 	}
Can anyone clarify why it fails with identity injected via @In--it used to work before?
Thanks--Alex


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4022432#4022432

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4022432



More information about the jboss-user mailing list