/*******************************************************************************
* Copyright (C) 2008 CS-Computer.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Contributors:
* CS-Computer - initial API and implementation
******************************************************************************/
package it.archiworld.aaa;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;
@Stateless
public class AuthenticationBean implements Authentication {
@PersistenceContext
private EntityManager manager;
/* (non-Javadoc)
* @see it.archiworld.aaa.Authentication#checkPassword(java.lang.String)
*/
public final User checkPassword(String password){
Query query = manager
.createQuery("Select user from User as user where user.password='"+password+"'");
return (User)query.getSingleResult();
}
}