package com.telephoners.krakyournet.ctf.auth;

import com.google.inject.Inject;
import com.telephoners.krakyournet.ctf.beans.User;
import com.telephoners.krakyournet.ctf.repositories.Repository;
import io.dropwizard.auth.AuthenticationException;
import io.dropwizard.auth.Authenticator;
import io.dropwizard.auth.basic.BasicCredentials;

public class UserAuthenticator implements Authenticator<BasicCredentials, User>
{
    private Repository<User> usersRepository;

    @Inject
    public UserAuthenticator(Repository<User> usersRepository)
    {
        this.usersRepository = usersRepository;
    }

    @Override
    public java.util.Optional<User> authenticate(BasicCredentials credentials) throws AuthenticationException
    {
        return null;
        /*
        User user = usersRepository.authenticateUser(credentials);
        if (user != null) {
            return Optional.of(user);
        }
        return Optional.absent();*/
    }
}