本文整理汇总了Java中org.apache.harmony.javax.security.auth.callback.CallbackHandler类的典型用法代码示例。如果您正苦于以下问题:Java CallbackHandler类的具体用法?Java CallbackHandler怎么用?Java CallbackHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CallbackHandler类属于org.apache.harmony.javax.security.auth.callback包,在下文中一共展示了CallbackHandler类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createSaslClient
import org.apache.harmony.javax.security.auth.callback.CallbackHandler; //导入依赖的package包/类
@Override
public SaslClient createSaslClient(String[] mechanisms,
String authorizationId, String protocol, String serverName,
Map<String, ?> props, CallbackHandler cbh) throws SaslException {
for (String mech: mechanisms) {
if ("PLAIN".equals(mech)) {
return new PlainSaslClient(authorizationId, cbh);
} else
if ("DIGEST-MD5".equals(mech)) {
return DigestMD5SaslClient.getClient(
authorizationId,
protocol,
serverName,
props,
cbh
);
}
}
return null;
}
开发者ID:samuelhehe,项目名称:androidpn_enhanced_client,代码行数:21,代码来源:SaslClientFactory.java
示例2: createSaslClient
import org.apache.harmony.javax.security.auth.callback.CallbackHandler; //导入依赖的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
示例3: createSaslClient
import org.apache.harmony.javax.security.auth.callback.CallbackHandler; //导入依赖的package包/类
public static SaslClient createSaslClient(String[] mechanisms,
String authanticationID, String protocol, String serverName,
Map<String, ?> prop, CallbackHandler cbh) throws SaslException {
if (mechanisms == null) {
throw new NullPointerException("auth.33"); //$NON-NLS-1$
}
SaslClientFactory fact = getSaslClientFactories().nextElement();
String[] mech = fact.getMechanismNames(null);
boolean is = false;
if (mech != null) {
for (int j = 0; j < mech.length; j++) {
for (int n = 0; n < mechanisms.length; n++) {
if (mech[j].equals(mechanisms[n])) {
is = true;
break;
}
}
}
}
if (is) {
return fact.createSaslClient(mechanisms, authanticationID,
protocol, serverName, prop, cbh);
}
return null;
}
开发者ID:ikantech,项目名称:xmppsupport_v2,代码行数:26,代码来源:Sasl.java
示例4: createSaslClient
import org.apache.harmony.javax.security.auth.callback.CallbackHandler; //导入依赖的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
示例5: createSaslClient
import org.apache.harmony.javax.security.auth.callback.CallbackHandler; //导入依赖的package包/类
public static SaslClient createSaslClient(String[] mechanisms, String authanticationID,
String protocol, String serverName, Map<String, ?> prop, CallbackHandler cbh)
throws SaslException {
if (mechanisms == null) {
throw new NullPointerException("auth.33"); //$NON-NLS-1$
}
SaslClientFactory fact = getSaslClientFactories().nextElement();
String[] mech = fact.getMechanismNames(null);
boolean is = false;
if (mech != null) {
for (int j = 0; j < mech.length; j++) {
for (int n = 0; n < mechanisms.length; n++) {
if (mech[j].equals(mechanisms[n])) {
is = true;
break;
}
}
}
}
if (is) {
return fact.createSaslClient(
mechanisms,
authanticationID,
protocol,
serverName,
prop,
cbh
);
}
return null;
}
开发者ID:samuelhehe,项目名称:androidpn_enhanced_client,代码行数:32,代码来源:Sasl.java
示例6: authenticate
import org.apache.harmony.javax.security.auth.callback.CallbackHandler; //导入依赖的package包/类
public String authenticate(String username, String resource, CallbackHandler cbh) throws XMPPException {
//Use the callback handler to determine the password, and continue on.
PasswordCallback pcb = new PasswordCallback("Password: ",false);
try {
cbh.handle(new Callback[]{pcb});
return authenticate(username, String.valueOf(pcb.getPassword()),resource);
} catch (Exception e) {
throw new XMPPException("Unable to determine password.",e);
}
}
开发者ID:samuelhehe,项目名称:androidpn_enhanced_client,代码行数:11,代码来源:NonSASLAuthentication.java
示例7: createSaslServer
import org.apache.harmony.javax.security.auth.callback.CallbackHandler; //导入依赖的package包/类
public static SaslServer createSaslServer(String mechanism, String protocol,
String serverName, Map<String, ?> prop, CallbackHandler cbh) throws SaslException {
if (mechanism == null) {
throw new NullPointerException("auth.32"); //$NON-NLS-1$
}
Collection<?> res = findFactories(SERVERFACTORYSRV);
if (res.isEmpty()) {
return null;
}
Iterator<?> iter = res.iterator();
while (iter.hasNext()) {
SaslServerFactory fact = (SaslServerFactory) iter.next();
String[] mech = fact.getMechanismNames(null);
boolean is = false;
if (mech != null) {
for (int j = 0; j < mech.length; j++) {
if (mech[j].equals(mechanism)) {
is = true;
break;
}
}
}
if (is) {
SaslServer saslS = fact.createSaslServer(mechanism, protocol, serverName, prop,
cbh);
if (saslS != null) {
return saslS;
}
}
}
return null;
}
开发者ID:samuelhehe,项目名称:androidpn_enhanced_client,代码行数:34,代码来源:Sasl.java
示例8: createSaslClient
import org.apache.harmony.javax.security.auth.callback.CallbackHandler; //导入依赖的package包/类
public static SaslClient createSaslClient(String[] mechanisms, String authanticationID,
String protocol, String serverName, Map<String, ?> prop, CallbackHandler cbh)
throws SaslException {
if (mechanisms == null) {
throw new NullPointerException("auth.33"); //$NON-NLS-1$
}
Collection<?> res = findFactories(CLIENTFACTORYSRV);
if (res.isEmpty()) {
return null;
}
Iterator<?> iter = res.iterator();
while (iter.hasNext()) {
SaslClientFactory fact = (SaslClientFactory) iter.next();
String[] mech = fact.getMechanismNames(null);
boolean is = false;
if (mech != null) {
for (int j = 0; j < mech.length; j++) {
for (int n = 0; n < mechanisms.length; n++) {
if (mech[j].equals(mechanisms[n])) {
is = true;
break;
}
}
}
}
if (is) {
SaslClient saslC = fact.createSaslClient(mechanisms, authanticationID,
protocol, serverName, prop, cbh);
if (saslC != null) {
return saslC;
}
}
}
return null;
}
开发者ID:samuelhehe,项目名称:androidpn_enhanced_client,代码行数:37,代码来源:Sasl.java
示例9: LoginContext
import org.apache.harmony.javax.security.auth.callback.CallbackHandler; //导入依赖的package包/类
public LoginContext(String name, CallbackHandler cbHandler) throws LoginException {
super();
if (cbHandler == null) {
throw new LoginException("auth.34"); //$NON-NLS-1$
}
init(name, null, cbHandler, null);
}
开发者ID:samuelhehe,项目名称:androidpn_enhanced_client,代码行数:8,代码来源:LoginContext.java
示例10: PlainSaslClient
import org.apache.harmony.javax.security.auth.callback.CallbackHandler; //导入依赖的package包/类
public PlainSaslClient(String authorizationID, CallbackHandler cbh) throws SaslException
{
completed = false;
this.cbh = cbh;
Object[] userInfo = getUserInfo();
this.authorizationID = authorizationID;
this.authenticationID = (String) userInfo[0];
this.password = (byte[]) userInfo[1];
if (authenticationID == null || password == null)
{
throw new SaslException("PLAIN: authenticationID and password must be specified");
}
}
开发者ID:samuelhehe,项目名称:androidpn_enhanced_client,代码行数:14,代码来源:PlainSaslClient.java
示例11: createSaslClient
import org.apache.harmony.javax.security.auth.callback.CallbackHandler; //导入依赖的package包/类
public SaslClient createSaslClient(String[] mechs, String authorizationId, String protocol,
String serverName, Map props, CallbackHandler cbh)
throws SaslException
{
for (int i = 0; i < mechs.length; i++)
{
if (mechs[i].equals("PLAIN"))
{
return new PlainSaslClient(authorizationId, cbh);
}
}
return null;
}
开发者ID:samuelhehe,项目名称:androidpn_enhanced_client,代码行数:14,代码来源:ClientSaslFactory.java
示例12: createSaslClient
import org.apache.harmony.javax.security.auth.callback.CallbackHandler; //导入依赖的package包/类
@Override
public SaslClient createSaslClient(String[] mechanisms,
String authorizationId, String protocol, String serverName,
Map<String, ?> props, CallbackHandler cbh) throws SaslException {
for (String mech: mechanisms) {
if ("PLAIN".equals(mech)) {
return new PlainSaslClient(authorizationId, cbh);
} else
if ("DIGEST-MD5".equals(mech)) {
return DigestMD5SaslClient.getClient(
authorizationId,
protocol,
serverName,
props,
cbh
);
}
if ("EXTERNAL".equals(mech)) {
return ExternalSaslClient.getClient(
authorizationId,
protocol,
serverName,
props,
cbh
);
}
}
return null;
}
开发者ID:CJC-ivotten,项目名称:androidPN-client.,代码行数:30,代码来源:SaslClientFactory.java
示例13: authenticate
import org.apache.harmony.javax.security.auth.callback.CallbackHandler; //导入依赖的package包/类
public void authenticate(String username, String host, CallbackHandler cbh)
throws IOException, XMPPException {
String[] mechanisms = { "DIGEST-MD5" };
Map<String, String> props = new HashMap<String, String>();
sc = Sasl.createSaslClient(mechanisms, null, "xmpp", host, props, cbh);
authenticate();
}
开发者ID:CJC-ivotten,项目名称:androidPN-client.,代码行数:8,代码来源:SASLFacebookConnect.java
示例14: createSaslClient
import org.apache.harmony.javax.security.auth.callback.CallbackHandler; //导入依赖的package包/类
@Override
public SaslClient createSaslClient(String[] mechanisms,
String authorizationId, String protocol, String serverName,
Map<String, ?> props, CallbackHandler cbh) throws SaslException {
for (String mech : mechanisms) {
if ("PLAIN".equals(mech)) {
return new PlainSaslClient(authorizationId, cbh);
} else if ("DIGEST-MD5".equals(mech)) {
return DigestMD5SaslClient.getClient(authorizationId, protocol,
serverName, props, cbh);
}
}
return null;
}
开发者ID:ikantech,项目名称:xmppsupport_v2,代码行数:15,代码来源:SaslClientFactory.java
示例15: authenticate
import org.apache.harmony.javax.security.auth.callback.CallbackHandler; //导入依赖的package包/类
public void authenticate(String username, String host, CallbackHandler cbh)
throws IOException, XMPPException {
String[] mechanisms = { "DIGEST-MD5" };
Map<String, String> props = new HashMap<String, String>();
sc = Sasl.createSaslClient(mechanisms, null, "xmpp", host, props, cbh);
authenticate();
}
开发者ID:ikantech,项目名称:xmppsupport_v2,代码行数:8,代码来源:SASLFacebookConnect.java
示例16: authenticate
import org.apache.harmony.javax.security.auth.callback.CallbackHandler; //导入依赖的package包/类
public String authenticate(String username, String resource,
CallbackHandler cbh) throws XMPPException {
// Use the callback handler to determine the password, and continue on.
PasswordCallback pcb = new PasswordCallback("Password: ", false);
try {
cbh.handle(new Callback[] { pcb });
return authenticate(username, String.valueOf(pcb.getPassword()),
resource);
} catch (Exception e) {
throw new XMPPException("Unable to determine password.", e);
}
}
开发者ID:ikantech,项目名称:xmppsupport_v2,代码行数:13,代码来源:NonSASLAuthentication.java
示例17: createSaslServer
import org.apache.harmony.javax.security.auth.callback.CallbackHandler; //导入依赖的package包/类
public static SaslServer createSaslServer(String mechanism,
String protocol, String serverName, Map<String, ?> prop,
CallbackHandler cbh) throws SaslException {
if (mechanism == null) {
throw new NullPointerException("auth.32"); //$NON-NLS-1$
}
Collection<?> res = findFactories(SERVERFACTORYSRV);
if (res.isEmpty()) {
return null;
}
Iterator<?> iter = res.iterator();
while (iter.hasNext()) {
SaslServerFactory fact = (SaslServerFactory) iter.next();
String[] mech = fact.getMechanismNames(null);
boolean is = false;
if (mech != null) {
for (int j = 0; j < mech.length; j++) {
if (mech[j].equals(mechanism)) {
is = true;
break;
}
}
}
if (is) {
SaslServer saslS = fact.createSaslServer(mechanism, protocol,
serverName, prop, cbh);
if (saslS != null) {
return saslS;
}
}
}
return null;
}
开发者ID:ikantech,项目名称:xmppsupport_v2,代码行数:35,代码来源:Sasl.java
示例18: createSaslClient
import org.apache.harmony.javax.security.auth.callback.CallbackHandler; //导入依赖的package包/类
public static SaslClient createSaslClient(String[] mechanisms,
String authanticationID, String protocol, String serverName,
Map<String, ?> prop, CallbackHandler cbh) throws SaslException {
if (mechanisms == null) {
throw new NullPointerException("auth.33"); //$NON-NLS-1$
}
Collection<?> res = findFactories(CLIENTFACTORYSRV);
if (res.isEmpty()) {
return null;
}
Iterator<?> iter = res.iterator();
while (iter.hasNext()) {
SaslClientFactory fact = (SaslClientFactory) iter.next();
String[] mech = fact.getMechanismNames(null);
boolean is = false;
if (mech != null) {
for (int j = 0; j < mech.length; j++) {
for (int n = 0; n < mechanisms.length; n++) {
if (mech[j].equals(mechanisms[n])) {
is = true;
break;
}
}
}
}
if (is) {
SaslClient saslC = fact.createSaslClient(mechanisms,
authanticationID, protocol, serverName, prop, cbh);
if (saslC != null) {
return saslC;
}
}
}
return null;
}
开发者ID:ikantech,项目名称:xmppsupport_v2,代码行数:37,代码来源:Sasl.java
示例19: LoginContext
import org.apache.harmony.javax.security.auth.callback.CallbackHandler; //导入依赖的package包/类
public LoginContext(String name, CallbackHandler cbHandler)
throws LoginException {
super();
if (cbHandler == null) {
throw new LoginException("auth.34"); //$NON-NLS-1$
}
init(name, null, cbHandler, null);
}
开发者ID:ikantech,项目名称:xmppsupport_v2,代码行数:9,代码来源:LoginContext.java
示例20: PlainSaslClient
import org.apache.harmony.javax.security.auth.callback.CallbackHandler; //导入依赖的package包/类
public PlainSaslClient(String authorizationID, CallbackHandler cbh)
throws SaslException {
completed = false;
this.cbh = cbh;
Object[] userInfo = getUserInfo();
this.authorizationID = authorizationID;
this.authenticationID = (String) userInfo[0];
this.password = (byte[]) userInfo[1];
if (authenticationID == null || password == null) {
throw new SaslException(
"PLAIN: authenticationID and password must be specified");
}
}
开发者ID:ikantech,项目名称:xmppsupport_v2,代码行数:14,代码来源:PlainSaslClient.java
注:本文中的org.apache.harmony.javax.security.auth.callback.CallbackHandler类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论