__author__ = 'slaskawi@redhat.com'

import os
import logging

# http://serverfault.com/questions/138572/exporting-user-keytabs-in-mit-kerberos

class KerberosAuthenticator:
    def __init__(self, configuration):
        self._configuration = configuration

    def authenticate(self):
        if self._configuration.get_keytab_file() is not None:
            logging.info("Authenticating using krb file: " + self._configuration.get_keytab_file())
            os.system(
                "kinit " + self._configuration.get_releasing_username() + " -k -t " + self._configuration.get_keytab_file());
