Switch to placeholders in conditional expressions; Ensure that Crsh auto configuration works without Spring Security

pull/118/merge
Christian Dupuis 11 years ago
parent cc941bf89b
commit 1f922f49b0

@ -108,39 +108,33 @@ public class CrshAutoConfiguration {
private CrshProperties properties; private CrshProperties properties;
@Bean @Bean
@ConditionalOnExpression("#{environment['shell.auth'] == 'jaas'}") @ConditionalOnExpression("'${shell.auth:simple}' == 'jaas'")
@ConditionalOnMissingBean({ AuthenticationProperties.class }) @ConditionalOnMissingBean({ AuthenticationProperties.class })
public AuthenticationProperties jaasAuthenticationProperties() { public AuthenticationProperties jaasAuthenticationProperties() {
return new JaasAuthenticationProperties(); return new JaasAuthenticationProperties();
} }
@Bean @Bean
@ConditionalOnExpression("#{environment['shell.auth'] == 'key'}") @ConditionalOnExpression("'${shell.auth:simple}' == 'key'")
@ConditionalOnMissingBean({ AuthenticationProperties.class }) @ConditionalOnMissingBean({ AuthenticationProperties.class })
public AuthenticationProperties keyAuthenticationProperties() { public AuthenticationProperties keyAuthenticationProperties() {
return new KeyAuthenticationProperties(); return new KeyAuthenticationProperties();
} }
@Bean @Bean
@ConditionalOnExpression("#{environment['shell.auth'] == 'simple'}") @ConditionalOnExpression("'${shell.auth:simple}' == 'simple'")
@ConditionalOnMissingBean({ AuthenticationProperties.class }) @ConditionalOnMissingBean({ AuthenticationProperties.class })
public AuthenticationProperties simpleAuthenticationProperties() { public AuthenticationProperties simpleAuthenticationProperties() {
return new SimpleAuthenticationProperties(); return new SimpleAuthenticationProperties();
} }
@Bean @Bean
@ConditionalOnExpression("#{environment['shell.auth'] == 'spring'}") @ConditionalOnExpression("'${shell.auth:simple}' == 'spring'")
@ConditionalOnMissingBean({ AuthenticationProperties.class }) @ConditionalOnMissingBean({ AuthenticationProperties.class })
public AuthenticationProperties SpringAuthenticationProperties() { public AuthenticationProperties SpringAuthenticationProperties() {
return new SpringAuthenticationProperties(); return new SpringAuthenticationProperties();
} }
@Bean
@ConditionalOnBean({ AuthenticationManager.class })
public CRaSHPlugin<?> shellAuthenticationManager() {
return new AuthenticationManagerAdapter();
}
@Bean @Bean
@ConditionalOnMissingBean({ PluginLifeCycle.class }) @ConditionalOnMissingBean({ PluginLifeCycle.class })
public PluginLifeCycle shellBootstrap() { public PluginLifeCycle shellBootstrap() {
@ -149,6 +143,17 @@ public class CrshAutoConfiguration {
return bs; return bs;
} }
@Configuration
@ConditionalOnBean({ AuthenticationManager.class })
public static class ShellAuthenticationManager {
@Bean
public CRaSHPlugin<?> shellAuthenticationManager() {
return new AuthenticationManagerAdapter();
}
}
public static class CrshBootstrap extends PluginLifeCycle { public static class CrshBootstrap extends PluginLifeCycle {
@Autowired @Autowired

Loading…
Cancel
Save