Search in sources :

Example 6 with User

use of com.tap5.hotelbooking.entities.User in project tapestry5-hotel-booking by ccordenier.

the class BasicAuthenticator method login.

public void login(String username, String password) throws AuthenticationException {
    User user = crudService.findUniqueWithNamedQuery(User.BY_CREDENTIALS, QueryParameters.with("username", username).and("password", password).parameters());
    if (user == null) {
        throw new AuthenticationException("The user doesn't exist");
    }
    request.getSession(true).setAttribute(AUTH_TOKEN, user);
}
Also used : User(com.tap5.hotelbooking.entities.User) AuthenticationException(com.tap5.hotelbooking.security.AuthenticationException)

Aggregations

User (com.tap5.hotelbooking.entities.User)5 AuthenticationException (com.tap5.hotelbooking.security.AuthenticationException)2 OnEvent (org.apache.tapestry5.annotations.OnEvent)2 Booking (com.tap5.hotelbooking.entities.Booking)1 Hotel (com.tap5.hotelbooking.entities.Hotel)1 ArrayList (java.util.ArrayList)1 Startup (org.apache.tapestry5.ioc.annotations.Startup)1