flex java authentification
Bonjour,
je développe une appli avec flex coté client et java coté serveur(avec blazeds).
au démarage de l'appli, j'ai un formulaire d'authentification qui appel un service coté java. J'ai bien configuré mes fichiers xml dans blazeds mais je bloque sur la partie authentification java.
J'ai une classe java qui implémente la classe flex.messaging.security.LoginCommand. Dans la méthode doAuthentication, je ne sais pas comment créer un object Principal et le retourner. Comment dois je procéder ?
voici ma classe Java
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
| public class AuthenticationService implements LoginCommand{
@Override
public Principal doAuthentication(String login, Object credentials) {
String password = "";
String msg = "Not a valid username or password";
Session session = HibernateUtil.currentSession();
User user = (User) session.createCriteria(User.class).add(
Restrictions.eq("login", login)).add(
Restrictions.eq("password", hashPassword(password))).setMaxResults(1)
.uniqueResult();
if(user ==null){
throw new SecurityException(msg);
}
?????????
return null;
}
@Override
public boolean doAuthorization(Principal arg0, List arg1) {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean logout(Principal arg0) {
// TODO Auto-generated method stub
return false;
}
@Override
public void start(ServletConfig arg0) {
// TODO Auto-generated method stub
}
@Override
public void stop() {
// TODO Auto-generated method stub
}
} |
Merci