@Override public GSSManager run() { return GSSManager.getInstance(); } });
private static boolean hasSpnegoSupport(GSSManager manager) throws GSSException { org.ietf.jgss.Oid spnego = new org.ietf.jgss.Oid("1.3.6.1.5.5.2"); org.ietf.jgss.Oid[] mechs = manager.getMechs(); for (Oid mech : mechs) { if (mech.equals(spnego)) { return true; } } return false; }
private boolean isCompatibleWithGssContext(final QOP qop) { switch (qop) { case AUTH_INT: return gssContext.getIntegState(); case AUTH_CONF: return gssContext.getIntegState() && gssContext.getConfState(); default: return true; } }
private GSSCredential getGSSCredential(final String userName) throws GSSException { Oid krb5Mechanism = new Oid(GSSAPI_OID); GSSManager manager = GSSManager.getInstance(); GSSName name = manager.createName(userName, GSSName.NT_USER_NAME); return manager.createCredential(name, GSSCredential.INDEFINITE_LIFETIME, krb5Mechanism, GSSCredential.INITIATE_ONLY); }
private static Oid createOid(String value) { try { return new Oid(value); } catch (GSSException e) { throw new AssertionError(e); } }
@Override public GSSCredential getGSSCredential(GSSManager mgr) throws GSSException { return manager.createCredential(GSSCredential.ACCEPT_ONLY); } }
@Override public int getRemainingLifetime() throws GSSException { return credential.getRemainingLifetime(); }
@Override public GSSName getName() throws GSSException { return credential.getName(); }
@Override public void add(GSSName name, int initLifetime, int acceptLifetime, Oid mech, int usage) throws GSSException { credential.add(name, initLifetime, acceptLifetime, mech, usage); }
@Override public Oid[] getMechs() throws GSSException { return credential.getMechs(); }
@Override public int getUsage(Oid mech) throws GSSException { return credential.getUsage(mech); }
@Override public int getRemainingInitLifetime(Oid mech) throws GSSException { return credential.getRemainingInitLifetime(mech); }
@Override public int getRemainingAcceptLifetime(Oid mech) throws GSSException { return credential.getRemainingAcceptLifetime(mech); }
/** * Construct a new instance with the default GSS manager. */ public Gs2SaslServerFactory() { this(GSSManager.getInstance()); }
private static Oid createOid(String value) { try { return new Oid(value); } catch (GSSException e) { throw new AssertionError(e); } }
public boolean needsRefresh() throws GSSException { return clientCredential.getRemainingLifetime() < MIN_CREDENTIAL_LIFETIME.getValue(SECONDS); } }
@Override public GSSName getName(Oid mech) throws GSSException { return credential.getName(mech); }
@Override public int getUsage() throws GSSException { return credential.getUsage(); }
/** * Construct a new instance with the default GSS manager. */ public Gs2SaslClientFactory() { this(GSSManager.getInstance()); }
public boolean needsRefresh() throws GSSException { return clientCredential.getRemainingLifetime() < MIN_CREDENTIAL_LIFETIME.getValue(SECONDS); } }