Java 类org.springframework.boot.actuate.autoconfigure.ShellProperties.SimpleAuthenticationProperties 实例源码

项目:contestparser    文件:ShellPropertiesTests.java   
@Test
public void testBindingSimple() {
    SimpleAuthenticationProperties props = new SimpleAuthenticationProperties();
    RelaxedDataBinder binder = new RelaxedDataBinder(props, "shell.auth.simple");
    binder.setConversionService(new DefaultConversionService());
    Map<String, String> map = new HashMap<String, String>();
    map.put("shell.auth.simple.user.name", "username123");
    map.put("shell.auth.simple.user.password", "password123");
    binder.bind(new MutablePropertyValues(map));
    assertFalse(binder.getBindingResult().hasErrors());

    Properties p = new Properties();
    props.applyToCrshShellConfig(p);

    assertEquals("username123", p.get("crash.auth.simple.username"));
    assertEquals("password123", p.get("crash.auth.simple.password"));
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:ShellPropertiesTests.java   
@Test
public void testBindingSimple() {
    SimpleAuthenticationProperties props = load(SimpleAuthenticationProperties.class,
            "management.shell.auth.simple.user.name=username123",
            "management.shell.auth.simple.user.password=password123");
    Properties p = new Properties();
    props.applyToCrshShellConfig(p);
    assertThat(p.get("crash.auth.simple.username")).isEqualTo("username123");
    assertThat(p.get("crash.auth.simple.password")).isEqualTo("password123");
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:ShellPropertiesTests.java   
@Test
public void testDefaultPasswordAutoGeneratedIfUnresolvedPlaceholder() {
    SimpleAuthenticationProperties security = load(
            SimpleAuthenticationProperties.class,
            "management.shell.auth.simple.user.password=${ADMIN_PASSWORD}");
    assertThat(security.getUser().isDefaultPassword()).isTrue();
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:ShellPropertiesTests.java   
@Test
public void testDefaultPasswordAutoGeneratedIfEmpty() {
    SimpleAuthenticationProperties security = load(
            SimpleAuthenticationProperties.class,
            "management.shell.auth.simple.user.password=");
    assertThat(security.getUser().isDefaultPassword()).isTrue();
}
项目:spring-boot-concourse    文件:ShellPropertiesTests.java   
@Test
public void testBindingSimple() {
    SimpleAuthenticationProperties props = load(SimpleAuthenticationProperties.class,
            "management.shell.auth.simple.user.name=username123",
            "management.shell.auth.simple.user.password=password123");
    Properties p = new Properties();
    props.applyToCrshShellConfig(p);
    assertThat(p.get("crash.auth.simple.username")).isEqualTo("username123");
    assertThat(p.get("crash.auth.simple.password")).isEqualTo("password123");
}
项目:spring-boot-concourse    文件:ShellPropertiesTests.java   
@Test
public void testDefaultPasswordAutoGeneratedIfUnresolvedPlaceholder() {
    SimpleAuthenticationProperties security = load(
            SimpleAuthenticationProperties.class,
            "management.shell.auth.simple.user.password=${ADMIN_PASSWORD}");
    assertThat(security.getUser().isDefaultPassword()).isTrue();
}
项目:spring-boot-concourse    文件:ShellPropertiesTests.java   
@Test
public void testDefaultPasswordAutoGeneratedIfEmpty() {
    SimpleAuthenticationProperties security = load(
            SimpleAuthenticationProperties.class,
            "management.shell.auth.simple.user.password=");
    assertThat(security.getUser().isDefaultPassword()).isTrue();
}
项目:contestparser    文件:ShellPropertiesTests.java   
@Test
public void testDefaultPasswordAutogeneratedIfUnresolovedPlaceholder() {
    SimpleAuthenticationProperties security = new SimpleAuthenticationProperties();
    RelaxedDataBinder binder = new RelaxedDataBinder(security, "security");
    binder.bind(new MutablePropertyValues(Collections
            .singletonMap("shell.auth.simple.user.password", "${ADMIN_PASSWORD}")));
    assertFalse(binder.getBindingResult().hasErrors());
    assertTrue(security.getUser().isDefaultPassword());
}
项目:contestparser    文件:ShellPropertiesTests.java   
@Test
public void testDefaultPasswordAutogeneratedIfEmpty() {
    SimpleAuthenticationProperties security = new SimpleAuthenticationProperties();
    RelaxedDataBinder binder = new RelaxedDataBinder(security, "security");
    binder.bind(new MutablePropertyValues(
            Collections.singletonMap("shell.auth.simple.user.password", "")));
    assertFalse(binder.getBindingResult().hasErrors());
    assertTrue(security.getUser().isDefaultPassword());
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:CrshAutoConfiguration.java   
@Bean
@ConditionalOnProperty(prefix = AUTH_PREFIX, name = "type", havingValue = "simple", matchIfMissing = true)
@ConditionalOnMissingBean(CrshShellAuthenticationProperties.class)
public SimpleAuthenticationProperties simpleAuthenticationProperties() {
    return new SimpleAuthenticationProperties();
}
项目:spring-boot-concourse    文件:CrshAutoConfiguration.java   
@Bean
@ConditionalOnProperty(prefix = AUTH_PREFIX, name = "type", havingValue = "simple", matchIfMissing = true)
@ConditionalOnMissingBean(CrshShellAuthenticationProperties.class)
public SimpleAuthenticationProperties simpleAuthenticationProperties() {
    return new SimpleAuthenticationProperties();
}
项目:contestparser    文件:CrshAutoConfiguration.java   
@Bean
@ConditionalOnProperty(prefix = "shell", name = "auth", havingValue = "simple", matchIfMissing = true)
@ConditionalOnMissingBean(CrshShellAuthenticationProperties.class)
public SimpleAuthenticationProperties simpleAuthenticationProperties() {
    return new SimpleAuthenticationProperties();
}