本文整理汇总了Java中org.apache.qpid.proton.engine.Sasl.getState方法的典型用法代码示例。如果您正苦于以下问题:Java Sasl.getState方法的具体用法?Java Sasl.getState怎么用?Java Sasl.getState使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.qpid.proton.engine.Sasl
的用法示例。
在下文中一共展示了Sasl.getState方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: performSaslSteps
import org.apache.qpid.proton.engine.Sasl; //导入方法依赖的package包/类
private void performSaslSteps(Connection connection, InputStream in,
OutputStream out,
SaslMechanism mechanism) throws IOException, LoginException {
Transport transport = connection.getTransport();
Sasl sasl = transport.sasl();
do {
readFromNetwork(connection, in, () ->
!(EnumSet.of(PN_SASL_PASS, PN_SASL_FAIL).contains(sasl.getState())
|| (sasl.getState() == PN_SASL_STEP && sasl.pending() > 0)));
if (sasl.pending() > 0) {
byte[] challenge = new byte[sasl.pending()];
byte[] response = mechanism.getResponse(challenge);
if (sasl.getState() == PN_SASL_STEP) {
sasl.send(response, 0, response.length);
writeToNetwork(connection, out);
}
}
} while (sasl.getState() == PN_SASL_STEP);
}
示例2: handleSaslOutcome
import org.apache.qpid.proton.engine.Sasl; //导入方法依赖的package包/类
public void handleSaslOutcome(Sasl sasl, Transport transport) {
try {
switch (sasl.getState()) {
case PN_SASL_FAIL:
handleSaslFail();
break;
case PN_SASL_PASS:
handleSaslCompletion(sasl);
break;
default:
break;
}
} catch (Throwable error) {
recordFailure(error.getMessage(), error);
}
}
示例3: isSaslAuthenticated
import org.apache.qpid.proton.engine.Sasl; //导入方法依赖的package包/类
private boolean isSaslAuthenticated(Connection connection, SaslMechanism mechanism) {
Transport transport = connection.getTransport();
Sasl sasl = transport.sasl();
return sasl.getState() == PN_SASL_PASS && mechanism.completedSuccessfully();
}