本文整理汇总了Java中de.measite.smack.Sasl类的典型用法代码示例。如果您正苦于以下问题:Java Sasl类的具体用法?Java Sasl怎么用?Java Sasl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Sasl类属于de.measite.smack包,在下文中一共展示了Sasl类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createSaslClient
import de.measite.smack.Sasl; //导入依赖的package包/类
public SaslClient createSaslClient(String[] mechanisms, String authorizationId, String protocol,
String serverName, Map<String, ?> props, CallbackHandler cbh)
throws SaslException
{
for (int i = 0; i < mechanisms.length; i++)
{
if (mechanisms[i].equals(MECHANISM))
{
if (cbh == null)
{
throw new SaslException("CallbackHandler must not be null");
}
String[] mechs = {"CRAM-MD5"};
return Sasl.createSaslClient(mechs, authorizationId, protocol, serverName, props, cbh);
}
}
return null;
}
开发者ID:samuelhehe,项目名称:androidpn_enhanced_client,代码行数:20,代码来源:CRAMMD5HashedSaslClientFactory.java
示例2: authenticate
import de.measite.smack.Sasl; //导入依赖的package包/类
public void authenticate(String apiKeyAndSessionKey, String host, String sessionSecret)
throws IOException, XMPPException {
if(apiKeyAndSessionKey==null || sessionSecret==null)
throw new IllegalStateException("Invalid parameters!");
String[] keyArray = apiKeyAndSessionKey.split("\\|");
if(keyArray==null || keyArray.length != 2)
throw new IllegalStateException("Api key or session key is not present!");
this.apiKey = keyArray[0];
this.sessionKey = keyArray[1];
this.sessionSecret = sessionSecret;
this.authenticationId = sessionKey;
this.password = sessionSecret;
this.hostname = host;
String[] mechanisms = { "DIGEST-MD5" };
Map<String, String> props = new HashMap<String, String>();
sc = Sasl.createSaslClient(mechanisms, null, "xmpp", host, props, this);
authenticate();
}
开发者ID:CJC-ivotten,项目名称:androidPN-client.,代码行数:25,代码来源:SASLFacebookConnect.java
示例3: getNegotiatedProperty
import de.measite.smack.Sasl; //导入依赖的package包/类
public Object getNegotiatedProperty(String propName)
{
if (completed)
{
if (propName.equals(Sasl.QOP))
{
return "auth";
}
else
{
return null;
}
}
else
{
throw new IllegalStateException("PLAIN: authentication not " +
"completed");
}
}
开发者ID:CJC-ivotten,项目名称:androidPN-client.,代码行数:20,代码来源:PlainSaslClient.java
示例4: authenticate
import de.measite.smack.Sasl; //导入依赖的package包/类
/**
* Builds and sends the <tt>auth</tt> stanza to the server. Note that this
* method of authentication is not recommended, since it is very inflexable.
* Use {@link #authenticate(String, String, CallbackHandler)} whenever
* possible.
*
* @param username
* the username of the user being authenticated.
* @param host
* the hostname where the user account resides.
* @param password
* the password for this account.
* @throws IOException
* If a network error occurs while authenticating.
* @throws XMPPException
* If a protocol error occurs or the user is not authenticated.
*/
public void authenticate(String username, String host, String password)
throws IOException, XMPPException {
// Since we were not provided with a CallbackHandler, we will use our
// own with the given
// information
// Set the authenticationID as the username, since they must be the same
// in this case.
this.authenticationId = username;
this.password = password;
this.hostname = host;
String[] mechanisms = { getName() };
Map<String, String> props = new HashMap<String, String>();
sc = Sasl.createSaslClient(mechanisms, username, "xmpp", host, props,
this);
authenticate();
}
开发者ID:ikantech,项目名称:xmppsupport_v2,代码行数:36,代码来源:SASLMechanism.java
示例5: authenticate
import de.measite.smack.Sasl; //导入依赖的package包/类
public void authenticate(String apiKeyAndSessionKey, String host,
String sessionSecret) throws IOException, XMPPException {
if (apiKeyAndSessionKey == null || sessionSecret == null)
throw new IllegalStateException("Invalid parameters!");
String[] keyArray = apiKeyAndSessionKey.split("\\|");
if (keyArray == null || keyArray.length != 2)
throw new IllegalStateException(
"Api key or session key is not present!");
this.apiKey = keyArray[0];
this.sessionKey = keyArray[1];
this.sessionSecret = sessionSecret;
this.authenticationId = sessionKey;
this.password = sessionSecret;
this.hostname = host;
String[] mechanisms = { "DIGEST-MD5" };
Map<String, String> props = new HashMap<String, String>();
sc = Sasl.createSaslClient(mechanisms, null, "xmpp", host, props, this);
authenticate();
}
开发者ID:ikantech,项目名称:xmppsupport_v2,代码行数:26,代码来源:SASLFacebookConnect.java
示例6: createSaslClient
import de.measite.smack.Sasl; //导入依赖的package包/类
public SaslClient createSaslClient(String[] mechanisms,
String authorizationId, String protocol, String serverName,
Map<String, ?> props, CallbackHandler cbh) throws SaslException {
for (int i = 0; i < mechanisms.length; i++) {
if (mechanisms[i].equals(MECHANISM)) {
if (cbh == null) {
throw new SaslException("CallbackHandler must not be null");
}
String[] mechs = { "CRAM-MD5" };
return Sasl.createSaslClient(mechs, authorizationId, protocol,
serverName, props, cbh);
}
}
return null;
}
开发者ID:ikantech,项目名称:xmppsupport_v2,代码行数:17,代码来源:CRAMMD5HashedSaslClientFactory.java
示例7: authenticate
import de.measite.smack.Sasl; //导入依赖的package包/类
/**
* Builds and sends the <tt>auth</tt> stanza to the server. Note that this method of
* authentication is not recommended, since it is very inflexable. Use
* {@link #authenticate(String, String, CallbackHandler)} whenever possible.
*
* @param username the username of the user being authenticated.
* @param host the hostname where the user account resides.
* @param password the password for this account.
* @throws IOException If a network error occurs while authenticating.
* @throws XMPPException If a protocol error occurs or the user is not authenticated.
*/
public void authenticate(String username, String host, String password) throws IOException, XMPPException {
//Since we were not provided with a CallbackHandler, we will use our own with the given
//information
//Set the authenticationID as the username, since they must be the same in this case.
this.authenticationId = username;
this.password = password;
this.hostname = host;
String[] mechanisms = { getName() };
Map<String,String> props = new HashMap<String,String>();
sc = Sasl.createSaslClient(mechanisms, username, "xmpp", host, props, this);
authenticate();
}
开发者ID:samuelhehe,项目名称:androidpn_enhanced_client,代码行数:26,代码来源:SASLMechanism.java
示例8: getNegotiatedProperty
import de.measite.smack.Sasl; //导入依赖的package包/类
public Object getNegotiatedProperty(String propName) {
if (completed) {
if (propName.equals(Sasl.QOP)) {
return "auth";
} else {
return null;
}
} else {
throw new IllegalStateException("PLAIN: authentication not "
+ "completed");
}
}
开发者ID:ikantech,项目名称:xmppsupport_v2,代码行数:13,代码来源:PlainSaslClient.java
示例9: authenticate
import de.measite.smack.Sasl; //导入依赖的package包/类
/**
* Builds and sends the <tt>auth</tt> stanza to the server. Note that this method of
* authentication is not recommended, since it is very inflexable. Use
* {@link #authenticate(String, String, org.apache.harmony.javax.security.auth.callback.CallbackHandler)} whenever possible.
*
* @param username the username of the user being authenticated.
* @param host the hostname where the user account resides.
* @param password the password for this account.
* @throws java.io.IOException If a network error occurs while authenticating.
* @throws XMPPException If a protocol error occurs or the user is not authenticated.
*/
public void authenticate(String username, String host, String password) throws IOException, XMPPException {
//Since we were not provided with a CallbackHandler, we will use our own with the given
//information
//Set the authenticationID as the username, since they must be the same in this case.
this.authenticationId = username;
this.password = password;
this.hostname = host;
String[] mechanisms = { getName() };
Map<String,String> props = new HashMap<String,String>();
sc = Sasl.createSaslClient(mechanisms, username, "xmpp", host, props, this);
authenticate();
}
开发者ID:msdx,项目名称:AndroidPNClient,代码行数:26,代码来源:SASLMechanism.java
示例10: authenticate
import de.measite.smack.Sasl; //导入依赖的package包/类
@Override
public void authenticate(String apiKey, String host, String accessToken) throws IOException, XMPPException {
if (apiKey == null || accessToken == null) {
throw new IllegalArgumentException("Invalid parameters");
}
this.apiKey = apiKey;
this.accessToken = accessToken;
this.hostname = host;
String[] mechanisms = { "DIGEST-MD5" };
Map<String, String> props = new HashMap<String, String>();
this.sc = Sasl.createSaslClient(mechanisms, null, "xmpp", host, props, this);
authenticate();
}
开发者ID:jonathangerbaud,项目名称:KlyphMessenger,代码行数:16,代码来源:SASLXFacebookPlatformMechanism.java
示例11: authenticate
import de.measite.smack.Sasl; //导入依赖的package包/类
public void authenticate(String username, String host, String password) throws IOException,
XMPPException {
authenticationId = username;
this.password = password;
hostname = host;
String mechanisms[] = { getName() };
java.util.Map props = new HashMap();
sc = Sasl.createSaslClient(mechanisms, null, "xmpp", host, props, this);
super.authenticate();
}
开发者ID:prive,项目名称:prive-android,代码行数:11,代码来源:MySASLDigestMD5Mechanism.java
示例12: authenticate
import de.measite.smack.Sasl; //导入依赖的package包/类
@Override
public void authenticate(String username, String host, String password) throws IOException, XMPPException {
//Since we were not provided with a CallbackHandler, we will use our own with the given
//information
//Set the authenticationID as the username, since they must be the same in this case.
this.authenticationId = username;
this.password = password;
this.hostname = host;
String[] mechanisms = {"PLAIN" };
Map<String, String> props = new HashMap<String, String>();
sc = Sasl.createSaslClient(mechanisms, username, "xmpp", host, props, this);
authenticate();
}
开发者ID:BoogieMAN2K,项目名称:Beem,代码行数:16,代码来源:SASLGoogleOAuth2Mechanism.java
示例13: authenticate
import de.measite.smack.Sasl; //导入依赖的package包/类
/**
* Builds and sends the <tt>auth</tt> stanza to the server.
* This overrides from the abstract class because the initial token
* needed for GSSAPI is binary, and not safe to put in a string, thus
* getAuthenticationText() cannot be used.
*
* @param username the username of the user being authenticated.
* @param host the hostname where the user account resides.
* @param cbh the CallbackHandler (not used with GSSAPI)
* @throws IOException If a network error occures while authenticating.
*/
public void authenticate(String username, String host, CallbackHandler cbh) throws IOException, XMPPException {
String[] mechanisms = { getName() };
Map props = new HashMap();
props.put(Sasl.SERVER_AUTH,"TRUE");
sc = Sasl.createSaslClient(mechanisms, username, "xmpp", host, props, cbh);
authenticate();
}
开发者ID:samuelhehe,项目名称:androidpn_enhanced_client,代码行数:19,代码来源:SASLGSSAPIMechanism.java
示例14: authenticate
import de.measite.smack.Sasl; //导入依赖的package包/类
/**
* Builds and sends the <tt>auth</tt> stanza to the server.
* This overrides from the abstract class because the initial token
* needed for GSSAPI is binary, and not safe to put in a string, thus
* getAuthenticationText() cannot be used.
*
* @param username the username of the user being authenticated.
* @param host the hostname where the user account resides.
* @param cbh the CallbackHandler (not used with GSSAPI)
* @throws IOException If a network error occures while authenticating.
*/
public void authenticate(String username, String host, CallbackHandler cbh) throws IOException, XMPPException {
String[] mechanisms = { getName() };
Map<String,String> props = new HashMap<String,String>();
props.put(Sasl.SERVER_AUTH,"TRUE");
sc = Sasl.createSaslClient(mechanisms, username, "xmpp", host, props, cbh);
authenticate();
}
开发者ID:CJC-ivotten,项目名称:androidPN-client.,代码行数:19,代码来源:SASLGSSAPIMechanism.java
注:本文中的de.measite.smack.Sasl类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论