// Path: src/main/java/org/chorem/ecd/service/AuthService.java
// @ApplicationScoped
// public class AuthService {
// 
//     private static final Logger logger = LoggerFactory.getLogger(AuthService.class);
// 
//     @Inject
//     private PersonDao personDao;
// 
//     private final Algorithm algorithm;
// 
//     private final JWTVerifier verifier;
// 
//     public AuthService() throws UnsupportedEncodingException {
//         algorithm = Algorithm.HMAC512("secretpassphrase");
//         verifier = JWT.require(algorithm).withIssuer("auth0").build();
//     }
// 
//     @TransactionRequired
//     public String getSignedToken(String subject, String password) {
//         if (Strings.isNullOrEmpty(subject) || Strings.isNullOrEmpty(password)) {
//             return null;
//         }
// 
//         Person person = new Person();
//         person.setName("John Doe");
//         personDao.addPerson(person);
// 
//         Instant now = Instant.now();
//         //now = null;
//         Instant expirationInstant = Instant.now().plus(Duration.ofMinutes(20));
// 
//         String token = JWT.create()
//                 .withIssuer("auth0")
//                 .withSubject(subject)
//                 .withIssuedAt(Date.from(now))
//                 .withExpiresAt(Date.from(expirationInstant))
//                 .sign(algorithm);
// 
//         return token;
//     }
// 
//     public Payload decodeSignedToken(String signedToken) {
//         try {
//             Payload verifiedToken = verifier.verify(signedToken);
//             return verifiedToken;
//         } catch(JWTVerificationException e) {
//             return null;
//         }
//     }
// 
// }


import org.chorem.ecd.service.AuthService;
import spark.Filter;
import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.context.Initialized;
import javax.enterprise.event.Observes;
import javax.inject.Inject;
package org.chorem.ecd.filter;



/**
 * @author Julien Gaston (gaston@codelutin.com)
 */
abstract public class AbstractFilter implements Filter {

    @Inject
// Path: src/main/java/org/chorem/ecd/service/AuthService.java
// @ApplicationScoped
// public class AuthService {
// 
//     private static final Logger logger = LoggerFactory.getLogger(AuthService.class);
// 
//     @Inject
//     private PersonDao personDao;
// 
//     private final Algorithm algorithm;
// 
//     private final JWTVerifier verifier;
// 
//     public AuthService() throws UnsupportedEncodingException {
//         algorithm = Algorithm.HMAC512("secretpassphrase");
//         verifier = JWT.require(algorithm).withIssuer("auth0").build();
//     }
// 
//     @TransactionRequired
//     public String getSignedToken(String subject, String password) {
//         if (Strings.isNullOrEmpty(subject) || Strings.isNullOrEmpty(password)) {
//             return null;
//         }
// 
//         Person person = new Person();
//         person.setName("John Doe");
//         personDao.addPerson(person);
// 
//         Instant now = Instant.now();
//         //now = null;
//         Instant expirationInstant = Instant.now().plus(Duration.ofMinutes(20));
// 
//         String token = JWT.create()
//                 .withIssuer("auth0")
//                 .withSubject(subject)
//                 .withIssuedAt(Date.from(now))
//                 .withExpiresAt(Date.from(expirationInstant))
//                 .sign(algorithm);
// 
//         return token;
//     }
// 
//     public Payload decodeSignedToken(String signedToken) {
//         try {
//             Payload verifiedToken = verifier.verify(signedToken);
//             return verifiedToken;
//         } catch(JWTVerificationException e) {
//             return null;
//         }
//     }
// 
// }


// Path: src/main/java/org/chorem/ecd/filter/AbstractFilter.java
import org.chorem.ecd.service.AuthService;
import spark.Filter;
import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.context.Initialized;
import javax.enterprise.event.Observes;
import javax.inject.Inject;

package org.chorem.ecd.filter;



/**
 * @author Julien Gaston (gaston@codelutin.com)
 */
abstract public class AbstractFilter implements Filter {

    @Inject
    protected AuthService authService;