Package org.springframework.boot.actuate.autoconfigure.ShellProperties

Examples of org.springframework.boot.actuate.autoconfigure.ShellProperties.SimpleAuthenticationProperties


  @Bean
  @ConditionalOnProperty(prefix = "shell", name = "auth", havingValue = "simple", matchIfMissing = true)
  @ConditionalOnMissingBean({ CrshShellAuthenticationProperties.class })
  public CrshShellAuthenticationProperties simpleAuthenticationProperties() {
    return new SimpleAuthenticationProperties();
  }
View Full Code Here


    assertNull(p.get("crash.auth.key.path"));
  }

  @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"));
  }
View Full Code Here

    assertEquals("password123", p.get("crash.auth.simple.password"));
  }

  @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());
  }
View Full Code Here

    assertTrue(security.getUser().isDefaultPassword());
  }

  @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());
  }
View Full Code Here

TOP

Related Classes of org.springframework.boot.actuate.autoconfigure.ShellProperties.SimpleAuthenticationProperties

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.