public void dispose() throws SaslException { try { gssContext.dispose(); } catch (GSSException e) { throw saslGs2.mechUnableToDisposeGssContext(e).toSaslException(); } finally { gssContext = null; } }
public void dispose() throws SaslException { try { gssContext.dispose(); } catch (GSSException e) { throw saslGs2.mechUnableToDisposeGssContext(e).toSaslException(); } finally { gssContext = null; } }
private Optional<Principal> authenticate(String token) { GSSContext context = doAs(loginContext.getSubject(), () -> gssManager.createContext(serverCredential)); try { byte[] inputToken = Base64.getDecoder().decode(token); context.acceptSecContext(inputToken, 0, inputToken.length); // We can't hold on to the GSS context because HTTP is stateless, so fail // if it can't be set up in a single challenge-response cycle if (context.isEstablished()) { return Optional.of(new KerberosPrincipal(context.getSrcName().toString())); } LOG.debug("Failed to establish GSS context for token %s", token); } catch (GSSException e) { // ignore and fail the authentication LOG.debug(e, "Authentication failed for token %s", token); } finally { try { context.dispose(); } catch (GSSException e) { // ignore } } return Optional.empty(); }
@Override public void dispose() throws SaslException { try { saslGssapi.trace("dispose"); gssContext.dispose(); } catch (GSSException e) { throw saslGssapi.mechUnableToDisposeGssContext(e).toSaslException(); } finally { gssContext = null; } }
gssContext.dispose();
try { if (context != null) { context.dispose();
try { if (context != null) { context.dispose();
gssContext.dispose();
@Override public String run() throws Exception { // This Oid for Kerberos GSS-API mechanism. Oid mechOid = new Oid("1.2.840.113554.1.2.2"); // Oid for kerberos principal name Oid krb5PrincipalOid = new Oid("1.2.840.113554.1.2.2.1"); GSSManager manager = GSSManager.getInstance(); // GSS name for server GSSName serverName = manager.createName(serverPrincipal, krb5PrincipalOid); // Create a GSSContext for authentication with the service. // We're passing client credentials as null since we want them to be read from the Subject. GSSContext gssContext = manager.createContext(serverName, mechOid, null, GSSContext.DEFAULT_LIFETIME); gssContext.requestMutualAuth(false); // Establish context byte[] inToken = new byte[0]; byte[] outToken = gssContext.initSecContext(inToken, 0, inToken.length); gssContext.dispose(); // Base64 encoded and stringified token for server return new String(base64codec.encode(outToken)); } }
if (gssContext != null) { try { gssContext.dispose(); } catch (GSSException e) { LOG.warn("Error while disposing GSS Context", e);
gssContext.dispose();
gssContext.dispose();
if (gssContext != null) { try { gssContext.dispose(); } catch (GSSException e) {
gssContext.dispose();
GSSManager manager = GSSManager.getInstance(); GSSName clientName = manager.createName("clientUser", GSSName.NT_USER_NAME); GSSCredential clientCred = manager.createCredential(clientName, 8 * 3600, createKerberosOid(), GSSCredential.INITIATE_ONLY); GSSName serverName = manager.createName("http@server", GSSName.NT_HOSTBASED_SERVICE); GSSContext context = manager.createContext(serverName, createKerberosOid(), clientCred, GSSContext.DEFAULT_LIFETIME); context.requestMutualAuth(true); context.requestConf(false); context.requestInteg(true); byte[] outToken = context.initSecContext(new byte[0], 0, 0); System.out.println(new BASE64Encoder().encode(outToken)); context.dispose();
gssContext.dispose();
public void dispose(){ try{ context.dispose(); } catch(GSSException ex){ } }
public void clear() { token = null; mutualAuth = false; delegationCredential = null; spnegoPrincipal = null; try { secContext.dispose(); } catch (GSSException e) { LOG.debug("Error in cleaning up a GSS context", e); } }
public void dispose() throws SaslException { try { gssContext.dispose(); } catch (GSSException e) { throw saslGs2.mechUnableToDisposeGssContext(e).toSaslException(); } finally { gssContext = null; } }
@Override public void dispose() throws SaslException { try { saslGssapi.trace("dispose"); gssContext.dispose(); } catch (GSSException e) { throw saslGssapi.mechUnableToDisposeGssContext(e).toSaslException(); } finally { gssContext = null; } }