KerberosAuthority implements Authority { @Override public void initialize() { login(false); } KerberosAuthority(String servicePrincipal, String keyTabConfFile, String jaasConfigSection);  KerberosAuthority(); Exception getInitState(); void setInitState(Exception exc); long getLoginWindow(); void setLoginWindow(long loginWindowMillis); long getLastLogin(); @Override void initialize(); @Override String getID(); @SuppressWarnings({ "unchecked", "rawtypes" }) synchronized void login(boolean logoutFirst); boolean refreshLogin(String remoteSvcPrincipal); @Override String getDomain(); @Override String getHeader(); @Override String getAuthenticateChallenge(); @Override Principal authenticate(String creds, String remoteAddr, String httpMethod, StringBuilder errMsg);  }
@Test public void testKerberosToken() { System.clearProperty(KRB_PROP_TOKEN_PRIV_ACTION); System.setProperty(KRB_PROP_TOKEN_PRIV_ACTION + "_TEST_REALM", "USER_REALM"); String token = "YWJjdGVzdA=="; System.setProperty(KerberosAuthority.KRB_PROP_SVCPRPL, "myserver@EXAMPLE.COM"); System.setProperty(KerberosAuthority.KRB_PROP_LOGIN_CB_CLASS, KRB_LOGIN_CB_CLASS); System.setProperty(KerberosAuthority.KRB_PROP_KEYTAB, "src/test/resources/example.keytab"); KerberosAuthority authority = new KerberosAuthority(); authority.initialize(); String creds = KerberosToken.KRB_AUTH_VAL_FLD + " " + token; String remoteAddr = "localhost"; KerberosToken ktoken = new KerberosToken(creds, remoteAddr); boolean ret = ktoken.validate(null, null); assertFalse(ret); StringBuilder errMsg = new StringBuilder(); ret = ktoken.validate(null, errMsg); assertFalse(ret); }