Commit 41cbbeba authored by Christian Dupuis's avatar Christian Dupuis

Re-Introduce authentication specific properties

parent e009d3e4
...@@ -45,7 +45,7 @@ import org.crsh.vfs.spi.FSDriver; ...@@ -45,7 +45,7 @@ import org.crsh.vfs.spi.FSDriver;
import org.springframework.beans.factory.ListableBeanFactory; import org.springframework.beans.factory.ListableBeanFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.actuate.properties.ShellProperties; import org.springframework.boot.actuate.properties.ShellProperties;
import org.springframework.boot.actuate.properties.ShellProperties.CrshShellProperties; import org.springframework.boot.actuate.properties.ShellProperties.CrshShellAuthenticationProperties;
import org.springframework.boot.actuate.properties.ShellProperties.JaasAuthenticationProperties; import org.springframework.boot.actuate.properties.ShellProperties.JaasAuthenticationProperties;
import org.springframework.boot.actuate.properties.ShellProperties.KeyAuthenticationProperties; import org.springframework.boot.actuate.properties.ShellProperties.KeyAuthenticationProperties;
import org.springframework.boot.actuate.properties.ShellProperties.SimpleAuthenticationProperties; import org.springframework.boot.actuate.properties.ShellProperties.SimpleAuthenticationProperties;
...@@ -110,25 +110,29 @@ public class CrshAutoConfiguration { ...@@ -110,25 +110,29 @@ public class CrshAutoConfiguration {
@Bean @Bean
@ConditionalOnExpression("'${shell.auth:simple}' == 'jaas'") @ConditionalOnExpression("'${shell.auth:simple}' == 'jaas'")
public CrshShellProperties jaasAuthenticationProperties() { @ConditionalOnMissingBean({ CrshShellAuthenticationProperties.class })
public CrshShellAuthenticationProperties jaasAuthenticationProperties() {
return new JaasAuthenticationProperties(); return new JaasAuthenticationProperties();
} }
@Bean @Bean
@ConditionalOnExpression("'${shell.auth:simple}' == 'key'") @ConditionalOnExpression("'${shell.auth:simple}' == 'key'")
public CrshShellProperties keyAuthenticationProperties() { @ConditionalOnMissingBean({ CrshShellAuthenticationProperties.class })
public CrshShellAuthenticationProperties keyAuthenticationProperties() {
return new KeyAuthenticationProperties(); return new KeyAuthenticationProperties();
} }
@Bean @Bean
@ConditionalOnExpression("'${shell.auth:simple}' == 'simple'") @ConditionalOnExpression("'${shell.auth:simple}' == 'simple'")
public CrshShellProperties simpleAuthenticationProperties() { @ConditionalOnMissingBean({ CrshShellAuthenticationProperties.class })
public CrshShellAuthenticationProperties simpleAuthenticationProperties() {
return new SimpleAuthenticationProperties(); return new SimpleAuthenticationProperties();
} }
@Bean @Bean
@ConditionalOnExpression("'${shell.auth:simple}' == 'spring'") @ConditionalOnExpression("'${shell.auth:simple}' == 'spring'")
public CrshShellProperties SpringAuthenticationProperties() { @ConditionalOnMissingBean({ CrshShellAuthenticationProperties.class })
public CrshShellAuthenticationProperties SpringAuthenticationProperties() {
return new SpringAuthenticationProperties(); return new SpringAuthenticationProperties();
} }
...@@ -142,7 +146,7 @@ public class CrshAutoConfiguration { ...@@ -142,7 +146,7 @@ public class CrshAutoConfiguration {
@Configuration @Configuration
@ConditionalOnBean({ AuthenticationManager.class }) @ConditionalOnBean({ AuthenticationManager.class })
public static class ShellAuthenticationManager { public static class AuthenticationManagerAdapterAutoConfiguration {
@Bean @Bean
public CRaSHPlugin<?> shellAuthenticationManager() { public CRaSHPlugin<?> shellAuthenticationManager() {
......
...@@ -149,7 +149,7 @@ public class ShellProperties { ...@@ -149,7 +149,7 @@ public class ShellProperties {
} }
/** /**
* Base class for Auth specific properties. * Base class for CRaSH properties.
*/ */
public static abstract class CrshShellProperties { public static abstract class CrshShellProperties {
...@@ -160,6 +160,14 @@ public class ShellProperties { ...@@ -160,6 +160,14 @@ public class ShellProperties {
} }
/**
* Base class for Auth specific properties.
*/
public static abstract class CrshShellAuthenticationProperties extends
CrshShellProperties {
}
/** /**
* SSH properties * SSH properties
*/ */
...@@ -236,7 +244,8 @@ public class ShellProperties { ...@@ -236,7 +244,8 @@ public class ShellProperties {
* Auth specific properties for JAAS authentication * Auth specific properties for JAAS authentication
*/ */
@ConfigurationProperties(name = "shell.auth.jaas", ignoreUnknownFields = false) @ConfigurationProperties(name = "shell.auth.jaas", ignoreUnknownFields = false)
public static class JaasAuthenticationProperties extends CrshShellProperties { public static class JaasAuthenticationProperties extends
CrshShellAuthenticationProperties {
private String domain = "my-domain"; private String domain = "my-domain";
...@@ -256,7 +265,8 @@ public class ShellProperties { ...@@ -256,7 +265,8 @@ public class ShellProperties {
* Auth specific properties for key authentication * Auth specific properties for key authentication
*/ */
@ConfigurationProperties(name = "shell.auth.key", ignoreUnknownFields = false) @ConfigurationProperties(name = "shell.auth.key", ignoreUnknownFields = false)
public static class KeyAuthenticationProperties extends CrshShellProperties { public static class KeyAuthenticationProperties extends
CrshShellAuthenticationProperties {
private String path; private String path;
...@@ -278,7 +288,8 @@ public class ShellProperties { ...@@ -278,7 +288,8 @@ public class ShellProperties {
* Auth specific properties for simple authentication * Auth specific properties for simple authentication
*/ */
@ConfigurationProperties(name = "shell.auth.simple", ignoreUnknownFields = false) @ConfigurationProperties(name = "shell.auth.simple", ignoreUnknownFields = false)
public static class SimpleAuthenticationProperties extends CrshShellProperties { public static class SimpleAuthenticationProperties extends
CrshShellAuthenticationProperties {
private static Log logger = LogFactory private static Log logger = LogFactory
.getLog(SimpleAuthenticationProperties.class); .getLog(SimpleAuthenticationProperties.class);
...@@ -323,7 +334,8 @@ public class ShellProperties { ...@@ -323,7 +334,8 @@ public class ShellProperties {
* Auth specific properties for Spring authentication * Auth specific properties for Spring authentication
*/ */
@ConfigurationProperties(name = "shell.auth.spring", ignoreUnknownFields = false) @ConfigurationProperties(name = "shell.auth.spring", ignoreUnknownFields = false)
public static class SpringAuthenticationProperties extends CrshShellProperties { public static class SpringAuthenticationProperties extends
CrshShellAuthenticationProperties {
private String[] roles = new String[] { "ROLE_ADMIN" }; private String[] roles = new String[] { "ROLE_ADMIN" };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment