Java 类javax.naming.AuthenticationNotSupportedException 实例源码

项目:cn1    文件:SaslBindTest.java   
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());
}
项目:cn1    文件:SaslBindTest.java   
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());
}
项目:freeVM    文件:SaslBindTest.java   
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());
}
项目:freeVM    文件:SaslBindTest.java   
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());
}
项目:web-harvester    文件:StatusController.java   
@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.");
    }
}
项目:cn1    文件:SaslBind.java   
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;
}
项目:cn1    文件:SaslBindTest.java   
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());
}
项目:nextop-client    文件:SaslBind.java   
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;
}
项目:freeVM    文件:SaslBind.java   
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;
}
项目:freeVM    文件:SaslBindTest.java   
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());
}
项目:cn1    文件:SaslBind.java   
public AuthMech valueAuthMech(Hashtable env)
        throws AuthenticationNotSupportedException {
    return externalValueAuthMech(env);
}
项目:nextop-client    文件:SaslBind.java   
public AuthMech valueAuthMech(Hashtable env)
        throws AuthenticationNotSupportedException {
    return externalValueAuthMech(env);
}
项目:freeVM    文件:SaslBind.java   
public AuthMech valueAuthMech(Hashtable env)
        throws AuthenticationNotSupportedException {
    return externalValueAuthMech(env);
}