本文整理汇总了Java中javax.naming.AuthenticationNotSupportedException类的典型用法代码示例。如果您正苦于以下问题:Java AuthenticationNotSupportedException类的具体用法?Java AuthenticationNotSupportedException怎么用?Java AuthenticationNotSupportedException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AuthenticationNotSupportedException类属于javax.naming包,在下文中一共展示了AuthenticationNotSupportedException类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: test_valueAuthMech_none
import javax.naming.AuthenticationNotSupportedException; //导入依赖的package包/类
public void test_valueAuthMech_none()
throws AuthenticationNotSupportedException {
sbind.valueAuthMech(env);
assertEquals(SaslBind.AuthMech.None, sbind.getAuthMech());
env.put(Context.SECURITY_CREDENTIALS, "test_credentials");
sbind.valueAuthMech(env);
assertEquals(SaslBind.AuthMech.None, sbind.getAuthMech());
env.clear();
env.put(Context.SECURITY_AUTHENTICATION, "none");
env.put(Context.SECURITY_PRINCIPAL, "test_principal");
env.put(Context.SECURITY_CREDENTIALS, "test_credentials");
sbind.valueAuthMech(env);
assertEquals(SaslBind.AuthMech.None, sbind.getAuthMech());
env.put(Context.SECURITY_AUTHENTICATION, "NoNe");
assertEquals(SaslBind.AuthMech.None, sbind.getAuthMech());
}
示例2: test_valueAuthMech_SASL
import javax.naming.AuthenticationNotSupportedException; //导入依赖的package包/类
public void test_valueAuthMech_SASL()
throws AuthenticationNotSupportedException {
env.put(Context.SECURITY_AUTHENTICATION, DIGEST_MD5);
sbind.valueAuthMech(env);
assertEquals(SaslBind.AuthMech.SASL, sbind.getAuthMech());
env.put(Context.SECURITY_AUTHENTICATION, CRAM_MD5);
sbind.valueAuthMech(env);
assertEquals(SaslBind.AuthMech.SASL, sbind.getAuthMech());
env.put(Context.SECURITY_AUTHENTICATION, GSSAPI);
sbind.valueAuthMech(env);
assertEquals(SaslBind.AuthMech.SASL, sbind.getAuthMech());
env.put(Context.SECURITY_AUTHENTICATION, EXTERNAL);
sbind.valueAuthMech(env);
assertEquals(SaslBind.AuthMech.SASL, sbind.getAuthMech());
env.put(Context.SECURITY_AUTHENTICATION,
" test test2 EXTERNAL test3 GSSAPI");
sbind.valueAuthMech(env);
assertEquals(SaslBind.AuthMech.SASL, sbind.getAuthMech());
}
示例3: assignUser
import javax.naming.AuthenticationNotSupportedException; //导入依赖的package包/类
@Secured(ROLE_ADMIN)
@RequestMapping(value = "/users/{organisationId}", method = RequestMethod.POST)
public void assignUser(@RequestParam("username") String username, @PathVariable("organisationId") Long id)
throws AuthenticationNotSupportedException {
if (!securityService.assignToOrganisation(username, id)) {
throw new AuthenticationNotSupportedException("Could not attach user to organisation.");
}
}
示例4: externalValueAuthMech
import javax.naming.AuthenticationNotSupportedException; //导入依赖的package包/类
private AuthMech externalValueAuthMech(Hashtable env)
throws AuthenticationNotSupportedException {
if (env == null) {
// FIXME: handle exception here?
return null;
}
if (env.get(Context.SECURITY_AUTHENTICATION) == null) {
if (env.get(Context.SECURITY_PRINCIPAL) == null) {
this.authMech = AuthMech.None;
} else {
this.authMech = AuthMech.Simple;
}
} else if (((String) env.get(Context.SECURITY_AUTHENTICATION))
.equalsIgnoreCase("none")) {
this.authMech = AuthMech.None;
} else if (((String) env.get(Context.SECURITY_AUTHENTICATION))
.equalsIgnoreCase("simple")) {
this.authMech = AuthMech.Simple;
} else if (valueSaslMech((String) env
.get(Context.SECURITY_AUTHENTICATION))) {
this.authMech = AuthMech.SASL;
} else {
throw new AuthenticationNotSupportedException((String) env
.get(Context.SECURITY_AUTHENTICATION));
}
return this.authMech;
}
示例5: test_valueAuthMech_simple
import javax.naming.AuthenticationNotSupportedException; //导入依赖的package包/类
public void test_valueAuthMech_simple()
throws AuthenticationNotSupportedException {
env.put(Context.SECURITY_PRINCIPAL, "test_principal");
sbind.valueAuthMech(env);
assertEquals(SaslBind.AuthMech.Simple, sbind.getAuthMech());
env.put(Context.SECURITY_AUTHENTICATION, "simple");
sbind.valueAuthMech(env);
assertEquals(SaslBind.AuthMech.Simple, sbind.getAuthMech());
env.put(Context.SECURITY_AUTHENTICATION, "SiMpLe");
sbind.valueAuthMech(env);
assertEquals(SaslBind.AuthMech.Simple, sbind.getAuthMech());
}
示例6: valueAuthMech
import javax.naming.AuthenticationNotSupportedException; //导入依赖的package包/类
public AuthMech valueAuthMech(Hashtable env)
throws AuthenticationNotSupportedException {
return externalValueAuthMech(env);
}