// TODO: do we need to call logout() on the LoginContext?
@Override
    public void refresh()
            throws LoginException, GSSException
    {
        // TODO: do we need to call logout() on the LoginContext?
        loginContext = new LoginContext("", null, null, new Configuration()
        {
            @Override
            public AppConfigurationEntry[] getAppConfigurationEntry(String name)
            {
                ImmutableMap.Builder<String, String> options = ImmutableMap.builder();
                options.put("refreshKrb5Config", "true");
                options.put("doNotPrompt", "true");
                options.put("useKeyTab", "true");
                if (getBoolean("trino.client.debugKerberos")) {
                    options.put("debug", "true");
                }
                keytab.ifPresent(file -> options.put("keyTab", file.getAbsolutePath()));
                credentialCache.ifPresent(file -> {
                    options.put("ticketCache", file.getAbsolutePath());
                    options.put("renewTGT", "true");
                });
                if (!keytab.isPresent() || credentialCache.isPresent()) {
                    options.put("useTicketCache", "true");
                }
                principal.ifPresent(value -> options.put("principal", value));
                return new AppConfigurationEntry[] {
                        new AppConfigurationEntry(Krb5LoginModule.class.getName(), REQUIRED, options.buildOrThrow())
                };
            }
        });
        loginContext.login();
    }
throws LoginException, GSSException
{
// TODO: do we need to call logout() on the LoginContext?
loginContext = new LoginContext("", null, null, new Configuration()
{
@Override
public void refresh()
throws LoginException, GSSException
{
// TODO: do we need to call logout() on the LoginContext?
loginContext = new LoginContext("", null, null, new Configuration()
{
@Override
public AppConfigurationEntry[] getAppConfigurationEntry(String name)
{
ImmutableMap.Builder<String, String> options = ImmutableMap.builder();
options.put("refreshKrb5Config", "true");
options.put("doNotPrompt", "true");
options.put("useKeyTab", "true");
if (getBoolean("trino.client.debugKerberos")) {
@Override
public void refresh()
throws LoginException, GSSException
{
// TODO: do we need to call logout() on the LoginContext?
loginContext = new LoginContext("", null, null, new Configuration()
{
@Override
public AppConfigurationEntry[] getAppConfigurationEntry(String name)
{
ImmutableMap.Builder<String, String> options = ImmutableMap.builder();
options.put("refreshKrb5Config", "true");
options.put("doNotPrompt", "true");
options.put("useKeyTab", "true");
if (getBoolean("trino.client.debugKerberos")) {
options.put("debug", "true");
}
keytab.ifPresent(file -> options.put("keyTab", file.getAbsolutePath()));
credentialCache.ifPresent(file -> {
options.put("ticketCache", file.getAbsolutePath());
options.put("renewTGT", "true");
});
if (!keytab.isPresent() || credentialCache.isPresent()) {
options.put("useTicketCache", "true");
}