// Path: testapps/jpa_model_id/src/main/java/jpa_test/model/User.java
// @Entity(name = "user")
// public class User extends UserBase implements UserLinked {
// 
//     @Id
//     @GeneratedValue(strategy = GenerationType.IDENTITY)
//     public Long id;
// 
//     public String firstName;
//     public String lastName;
// 
//     @Override
//     public boolean isLinkedTo(Principal user) {
//         return S.eq(email, user.getName());
//     }
// 
//     @Stateless
//     public static class Dao extends JPADao<Long, User> {
// 
//         public User findByUsername(String username) {
//             return findOneBy("email", username);
//         }
// 
//         public boolean authenticate(String username, char[] password) {
//             User user = findByUsername(username);
//             if (null == user) {
//                 return false;
//             }
//             return user.verifyPassword(password);
//         }
// 
//     }
// }


import static org.osgl.http.H.Method.GET;
import static org.osgl.http.H.Method.POST;
import act.app.ActionContext;
import org.osgl.mvc.annotation.Action;
import org.osgl.mvc.annotation.PostAction;
import jpa_test.model.User;
package jpa_test.endpoint;



public class AuthenticateService extends PublicServiceBaseV1 {

    @PostAction("login")
// Path: testapps/jpa_model_id/src/main/java/jpa_test/model/User.java
// @Entity(name = "user")
// public class User extends UserBase implements UserLinked {
// 
//     @Id
//     @GeneratedValue(strategy = GenerationType.IDENTITY)
//     public Long id;
// 
//     public String firstName;
//     public String lastName;
// 
//     @Override
//     public boolean isLinkedTo(Principal user) {
//         return S.eq(email, user.getName());
//     }
// 
//     @Stateless
//     public static class Dao extends JPADao<Long, User> {
// 
//         public User findByUsername(String username) {
//             return findOneBy("email", username);
//         }
// 
//         public boolean authenticate(String username, char[] password) {
//             User user = findByUsername(username);
//             if (null == user) {
//                 return false;
//             }
//             return user.verifyPassword(password);
//         }
// 
//     }
// }


// Path: testapps/jpa_model_id/src/main/java/jpa_test/endpoint/AuthenticateService.java
import static org.osgl.http.H.Method.GET;
import static org.osgl.http.H.Method.POST;
import act.app.ActionContext;
import org.osgl.mvc.annotation.Action;
import org.osgl.mvc.annotation.PostAction;
import jpa_test.model.User;

package jpa_test.endpoint;



public class AuthenticateService extends PublicServiceBaseV1 {

    @PostAction("login")
    public void login(String username, char[] password, ActionContext ctx, User.Dao userDao) {