jeudi 26 novembre 2020

Changing the kerberos principal

I am writing a test which checks that we can create a kafka producer and send messages to a kafka cluster that uses kerberos for authentication. This works fine. (test1)

I also need to write a test which checks that a non authenticated user cannot create producer/send messages (the principal in Jaas is not right). (test2)

The tests look like :

public void test(){
        System.setProperty("java.security.auth.login.config", **jaas_path**);
        System.setProperty("java.security.krb5.conf", **krb5_path**);

        createKafkaProducer();
        sendMessages();
}

The test1 has the jaas_path of the right jaas file and the test2 the path of a jaas file with wrong principal.

My problem is that if the test1 run first, the test2 still uses the principal of the jaas of the test1. I mean that the test2 has still loaded the jaas file (principal & keytab) of the test1 and uses them.

Is there any way to 'erase' the memory or delete/change the principal ?

Aucun commentaire:

Enregistrer un commentaire