private void doDigestRpc(Server server, TestTokenSecretManager sm ) throws Exception { server.start(); final UserGroupInformation current = UserGroupInformation.getCurrentUser(); final InetSocketAddress addr = NetUtils.getConnectAddress(server); TestTokenIdentifier tokenId = new TestTokenIdentifier(new Text(current .getUserName())); Token<TestTokenIdentifier> token = new Token<TestTokenIdentifier>(tokenId, sm); SecurityUtil.setTokenService(token, addr); current.addToken(token); TestSaslProtocol proxy = null; try { proxy = RPC.getProxy(TestSaslProtocol.class, TestSaslProtocol.versionID, addr, conf); AuthMethod authMethod = proxy.getAuthMethod(); assertEquals(TOKEN, authMethod); //QOP must be auth assertEquals(expectedQop.saslQop, RPC.getConnectionIdForProxy(proxy).getSaslQop()); proxy.ping(); } finally { server.stop(); if (proxy != null) { RPC.stopProxy(proxy); } } }
private void doDigestRpc(Server server, TestTokenSecretManager sm ) throws Exception { server.start(); final UserGroupInformation current = UserGroupInformation.getCurrentUser(); final InetSocketAddress addr = NetUtils.getConnectAddress(server); TestTokenIdentifier tokenId = new TestTokenIdentifier(new Text(current .getUserName())); Token<TestTokenIdentifier> token = new Token<TestTokenIdentifier>(tokenId, sm); SecurityUtil.setTokenService(token, addr); current.addToken(token); TestSaslProtocol proxy = null; try { proxy = RPC.getProxy(TestSaslProtocol.class, TestSaslProtocol.versionID, addr, conf); AuthMethod authMethod = proxy.getAuthMethod(); assertEquals(TOKEN, authMethod); //QOP must be auth assertEquals(expectedQop.saslQop, RPC.getConnectionIdForProxy(proxy).getSaslQop()); proxy.ping(); } finally { server.stop(); if (proxy != null) { RPC.stopProxy(proxy); } } }
@Override public String run() throws IOException { TestSaslProtocol proxy = null; try { proxy = RPC.getProxy(TestSaslProtocol.class, TestSaslProtocol.versionID, addr, clientConf); proxy.ping(); // make sure the other side thinks we are who we said we are!!! assertEquals(clientUgi.getUserName(), proxy.getAuthUser()); AuthMethod authMethod = proxy.getAuthMethod(); // verify sasl completed with correct QOP assertEquals((authMethod != SIMPLE) ? expectedQop.saslQop : null, RPC.getConnectionIdForProxy(proxy).getSaslQop()); return authMethod.toString(); } finally { if (proxy != null) { RPC.stopProxy(proxy); } } } });
@Override public String run() throws IOException { TestSaslProtocol proxy = null; try { proxy = RPC.getProxy(TestSaslProtocol.class, TestSaslProtocol.versionID, addr, clientConf); proxy.ping(); // make sure the other side thinks we are who we said we are!!! assertEquals(clientUgi.getUserName(), proxy.getAuthUser()); AuthMethod authMethod = proxy.getAuthMethod(); // verify sasl completed with correct QOP assertEquals((authMethod != SIMPLE) ? expectedQop.saslQop : null, RPC.getConnectionIdForProxy(proxy).getSaslQop()); return authMethod.toString(); } finally { if (proxy != null) { RPC.stopProxy(proxy); } } } });