/** * @return Token client */ public synchronized KrbTokenClient getTokenClient() { if (tokenClient == null) { tokenClient = new KrbTokenClient(krbClnt); } return tokenClient; }
public static SgtTicket applySgtCredential(TgtTicket tgt, KrbToken krbToken, String server) throws GSSException { KrbTokenClient client = getKrbTokenClient(); try { client.init(); return client.requestSgt(krbToken, server, tgt); } catch (KrbException e) { throw new GSSException(GSSException.FAILURE, -1, e.getMessage()); } }
KrbTokenClient tokenClient = new KrbTokenClient(krbClient); try { tgtTicket = tokenClient.requestTgt(krbToken, armorCache.getAbsolutePath()); } catch (KrbException e) {
public SgtTicket requestSgt(KrbToken token, String serverPrincipal, TgtTicket tgt) throws KrbException { if (!token.isAcToken()) { throw new IllegalArgumentException("Access token is expected"); } KOptions requestOptions = new KOptions(); requestOptions.add(TokenOption.USER_AC_TOKEN, token); requestOptions.add(KrbOption.TGT, tgt); requestOptions.add(KrbOption.SERVER_PRINCIPAL, serverPrincipal); return requestSgt(requestOptions); } }
/** * Request a TGT with user token credential and armor cache * @param token The KrbToken * @param armorCache The armor cache * @return TGT * @throws KrbException e */ public TgtTicket requestTgt(KrbToken token, String armorCache) throws KrbException { if (!token.isIdToken()) { throw new IllegalArgumentException("Identity token is expected"); } KOptions requestOptions = new KOptions(); requestOptions.add(TokenOption.USER_ID_TOKEN, token); requestOptions.add(KrbOption.ARMOR_CACHE, armorCache); return requestTgt(requestOptions); }
KrbTokenClient tokenClient = new KrbTokenClient(krbClient); try { tgtTicket = tokenClient.requestTgt(krbToken, armorCache.getAbsolutePath()); } catch (KrbException e) {
public SgtTicket requestSgt(KrbToken token, String serverPrincipal, TgtTicket tgt) throws KrbException { if (!token.isAcToken()) { throw new IllegalArgumentException("Access token is expected"); } KOptions requestOptions = new KOptions(); requestOptions.add(TokenOption.USER_AC_TOKEN, token); requestOptions.add(KrbOption.TGT, tgt); requestOptions.add(KrbOption.SERVER_PRINCIPAL, serverPrincipal); return requestSgt(requestOptions); } }
/** * Request a TGT with user token credential and tgt * @param token The KrbToken * @param tgt The tgt ticket * @return TGT * @throws KrbException e */ public TgtTicket requestTgt(KrbToken token, TgtTicket tgt) throws KrbException { if (!token.isIdToken()) { throw new IllegalArgumentException("Identity token is expected"); } KOptions requestOptions = new KOptions(); requestOptions.add(TokenOption.USER_ID_TOKEN, token); requestOptions.add(KrbOption.TGT, tgt); return requestTgt(requestOptions); }
/** * @return Token client */ public synchronized KrbTokenClient getTokenClient() { if (tokenClient == null) { tokenClient = new KrbTokenClient(krbClnt); } return tokenClient; }
/** * Request a service ticket using an Access Token. * @param token The KrbToken * @param serverPrincipal The server principal * @param armorCache The armor cache * @return service ticket * @throws KrbException e */ public SgtTicket requestSgt( KrbToken token, String serverPrincipal, String armorCache) throws KrbException { if (!token.isAcToken()) { throw new IllegalArgumentException("Access token is expected"); } KOptions requestOptions = new KOptions(); requestOptions.add(TokenOption.USER_AC_TOKEN, token); requestOptions.add(KrbOption.ARMOR_CACHE, armorCache); requestOptions.add(KrbOption.SERVER_PRINCIPAL, serverPrincipal); return requestSgt(requestOptions); }
/** * Request a TGT with user token credential and armor cache * @param token The KrbToken * @param armorCache The armor cache * @return TGT * @throws KrbException e */ public TgtTicket requestTgt(KrbToken token, String armorCache) throws KrbException { if (!token.isIdToken()) { throw new IllegalArgumentException("Identity token is expected"); } KOptions requestOptions = new KOptions(); requestOptions.add(TokenOption.USER_ID_TOKEN, token); requestOptions.add(KrbOption.ARMOR_CACHE, armorCache); return requestTgt(requestOptions); }
public static KrbTokenClient getKrbTokenClient() { try { String systemProperty = getSystemProperty("java.security.krb5.conf"); if (systemProperty != null) { File confSpecified = new File(systemProperty); if (confSpecified.exists()) { return new KrbTokenClient(confSpecified); } } // get configuration file from environment variable or default path return new KrbTokenClient(); } catch (KrbException e) { return null; } }
/** * Request a service ticket using an Access Token. * @param token The KrbToken * @param serverPrincipal The server principal * @param armorCache The armor cache * @return service ticket * @throws KrbException e */ public SgtTicket requestSgt( KrbToken token, String serverPrincipal, String armorCache) throws KrbException { if (!token.isAcToken()) { throw new IllegalArgumentException("Access token is expected"); } KOptions requestOptions = new KOptions(); requestOptions.add(TokenOption.USER_AC_TOKEN, token); requestOptions.add(KrbOption.ARMOR_CACHE, armorCache); requestOptions.add(KrbOption.SERVER_PRINCIPAL, serverPrincipal); return requestSgt(requestOptions); }
/** * Request a TGT with user token credential and tgt * @param token The KrbToken * @param tgt The tgt ticket * @return TGT * @throws KrbException e */ public TgtTicket requestTgt(KrbToken token, TgtTicket tgt) throws KrbException { if (!token.isIdToken()) { throw new IllegalArgumentException("Identity token is expected"); } KOptions requestOptions = new KOptions(); requestOptions.add(TokenOption.USER_ID_TOKEN, token); requestOptions.add(KrbOption.TGT, tgt); return requestTgt(requestOptions); }