@Test public void testBindingJaas() { JaasAuthenticationProperties props = load(JaasAuthenticationProperties.class, "management.shell.auth.jaas.domain=my-test-domain"); Properties p = new Properties(); props.applyToCrshShellConfig(p); assertThat(p.get("crash.auth.jaas.domain")).isEqualTo("my-test-domain"); }
@Test public void testBindingJaas() { JaasAuthenticationProperties props = new JaasAuthenticationProperties(); RelaxedDataBinder binder = new RelaxedDataBinder(props, "shell.auth.jaas"); binder.setConversionService(new DefaultConversionService()); Map<String, String> map = new HashMap<String, String>(); map.put("shell.auth.jaas.domain", "my-test-domain"); binder.bind(new MutablePropertyValues(map)); assertFalse(binder.getBindingResult().hasErrors()); Properties p = new Properties(); props.applyToCrshShellConfig(p); assertEquals("my-test-domain", p.get("crash.auth.jaas.domain")); }
@Bean @ConditionalOnProperty(prefix = AUTH_PREFIX, name = "type", havingValue = "jaas") @ConditionalOnMissingBean(CrshShellAuthenticationProperties.class) public JaasAuthenticationProperties jaasAuthenticationProperties() { return new JaasAuthenticationProperties(); }
@Bean @ConditionalOnProperty(prefix = "shell", name = "auth", havingValue = "jaas") @ConditionalOnMissingBean(CrshShellAuthenticationProperties.class) public JaasAuthenticationProperties jaasAuthenticationProperties() { return new JaasAuthenticationProperties(); }