Skip to content

Commit 41cbbeb

Browse files
committed
Re-Introduce authentication specific properties
1 parent e009d3e commit 41cbbeb

File tree

2 files changed

+27
-11
lines changed

2 files changed

+27
-11
lines changed

spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/CrshAutoConfiguration.java

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
import org.springframework.beans.factory.ListableBeanFactory;
4646
import org.springframework.beans.factory.annotation.Autowired;
4747
import org.springframework.boot.actuate.properties.ShellProperties;
48-
import org.springframework.boot.actuate.properties.ShellProperties.CrshShellProperties;
48+
import org.springframework.boot.actuate.properties.ShellProperties.CrshShellAuthenticationProperties;
4949
import org.springframework.boot.actuate.properties.ShellProperties.JaasAuthenticationProperties;
5050
import org.springframework.boot.actuate.properties.ShellProperties.KeyAuthenticationProperties;
5151
import org.springframework.boot.actuate.properties.ShellProperties.SimpleAuthenticationProperties;
@@ -110,25 +110,29 @@ public class CrshAutoConfiguration {
110110

111111
@Bean
112112
@ConditionalOnExpression("'${shell.auth:simple}' == 'jaas'")
113-
public CrshShellProperties jaasAuthenticationProperties() {
113+
@ConditionalOnMissingBean({ CrshShellAuthenticationProperties.class })
114+
public CrshShellAuthenticationProperties jaasAuthenticationProperties() {
114115
return new JaasAuthenticationProperties();
115116
}
116117

117118
@Bean
118119
@ConditionalOnExpression("'${shell.auth:simple}' == 'key'")
119-
public CrshShellProperties keyAuthenticationProperties() {
120+
@ConditionalOnMissingBean({ CrshShellAuthenticationProperties.class })
121+
public CrshShellAuthenticationProperties keyAuthenticationProperties() {
120122
return new KeyAuthenticationProperties();
121123
}
122124

123125
@Bean
124126
@ConditionalOnExpression("'${shell.auth:simple}' == 'simple'")
125-
public CrshShellProperties simpleAuthenticationProperties() {
127+
@ConditionalOnMissingBean({ CrshShellAuthenticationProperties.class })
128+
public CrshShellAuthenticationProperties simpleAuthenticationProperties() {
126129
return new SimpleAuthenticationProperties();
127130
}
128131

129132
@Bean
130133
@ConditionalOnExpression("'${shell.auth:simple}' == 'spring'")
131-
public CrshShellProperties SpringAuthenticationProperties() {
134+
@ConditionalOnMissingBean({ CrshShellAuthenticationProperties.class })
135+
public CrshShellAuthenticationProperties SpringAuthenticationProperties() {
132136
return new SpringAuthenticationProperties();
133137
}
134138

@@ -142,7 +146,7 @@ public PluginLifeCycle shellBootstrap() {
142146

143147
@Configuration
144148
@ConditionalOnBean({ AuthenticationManager.class })
145-
public static class ShellAuthenticationManager {
149+
public static class AuthenticationManagerAdapterAutoConfiguration {
146150

147151
@Bean
148152
public CRaSHPlugin<?> shellAuthenticationManager() {

spring-boot-actuator/src/main/java/org/springframework/boot/actuate/properties/ShellProperties.java

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ public Properties asCrshShellConfig() {
149149
}
150150

151151
/**
152-
* Base class for Auth specific properties.
152+
* Base class for CRaSH properties.
153153
*/
154154
public static abstract class CrshShellProperties {
155155

@@ -160,6 +160,14 @@ public static abstract class CrshShellProperties {
160160

161161
}
162162

163+
/**
164+
* Base class for Auth specific properties.
165+
*/
166+
public static abstract class CrshShellAuthenticationProperties extends
167+
CrshShellProperties {
168+
169+
}
170+
163171
/**
164172
* SSH properties
165173
*/
@@ -236,7 +244,8 @@ public void setPort(Integer port) {
236244
* Auth specific properties for JAAS authentication
237245
*/
238246
@ConfigurationProperties(name = "shell.auth.jaas", ignoreUnknownFields = false)
239-
public static class JaasAuthenticationProperties extends CrshShellProperties {
247+
public static class JaasAuthenticationProperties extends
248+
CrshShellAuthenticationProperties {
240249

241250
private String domain = "my-domain";
242251

@@ -256,7 +265,8 @@ public void setDomain(String domain) {
256265
* Auth specific properties for key authentication
257266
*/
258267
@ConfigurationProperties(name = "shell.auth.key", ignoreUnknownFields = false)
259-
public static class KeyAuthenticationProperties extends CrshShellProperties {
268+
public static class KeyAuthenticationProperties extends
269+
CrshShellAuthenticationProperties {
260270

261271
private String path;
262272

@@ -278,7 +288,8 @@ public void setPath(String path) {
278288
* Auth specific properties for simple authentication
279289
*/
280290
@ConfigurationProperties(name = "shell.auth.simple", ignoreUnknownFields = false)
281-
public static class SimpleAuthenticationProperties extends CrshShellProperties {
291+
public static class SimpleAuthenticationProperties extends
292+
CrshShellAuthenticationProperties {
282293

283294
private static Log logger = LogFactory
284295
.getLog(SimpleAuthenticationProperties.class);
@@ -323,7 +334,8 @@ public void setPassword(String password) {
323334
* Auth specific properties for Spring authentication
324335
*/
325336
@ConfigurationProperties(name = "shell.auth.spring", ignoreUnknownFields = false)
326-
public static class SpringAuthenticationProperties extends CrshShellProperties {
337+
public static class SpringAuthenticationProperties extends
338+
CrshShellAuthenticationProperties {
327339

328340
private String[] roles = new String[] { "ROLE_ADMIN" };
329341

0 commit comments

Comments
 (0)