Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
72aae34b
Commit
72aae34b
authored
Feb 24, 2016
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5032 from Matt Benson
* gh-5032: Fix logic for disabling plugins in CrshAutoConfiguration
parents
aa175996
2a9e6c40
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
11 deletions
+21
-11
CrshAutoConfiguration.java
...ork/boot/actuate/autoconfigure/CrshAutoConfiguration.java
+5
-4
CrshAutoConfigurationTests.java
...oot/actuate/autoconfigure/CrshAutoConfigurationTests.java
+16
-7
No files found.
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/CrshAutoConfiguration.java
View file @
72aae34b
/*
* Copyright 2012-201
5
the original author or authors.
* Copyright 2012-201
6
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
@@ -111,6 +111,7 @@ import org.springframework.util.StringUtils;
* {@code shell.command_path_patterns} in your application configuration.
*
* @author Christian Dupuis
* @author Matt Benson
* @see ShellProperties
*/
@Configuration
...
...
@@ -395,11 +396,11 @@ public class CrshAutoConfiguration {
pluginClasses
.
add
(
plugin
.
getClass
());
for
(
Class
<?>
pluginClass
:
pluginClasses
)
{
if
(
isEnabled
(
pluginClass
))
{
return
tru
e
;
if
(
!
isEnabled
(
pluginClass
))
{
return
fals
e
;
}
}
return
fals
e
;
return
tru
e
;
}
private
boolean
isEnabled
(
Class
<?>
pluginClass
)
{
...
...
spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/CrshAutoConfigurationTests.java
View file @
72aae34b
/*
* Copyright 2012-201
5
the original author or authors.
* Copyright 2012-201
6
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
@@ -25,11 +25,13 @@ import java.util.UUID;
import
org.crsh.auth.AuthenticationPlugin
;
import
org.crsh.auth.JaasAuthenticationPlugin
;
import
org.crsh.lang.impl.groovy.GroovyRepl
;
import
org.crsh.lang.impl.java.JavaLanguage
;
import
org.crsh.lang.spi.Language
;
import
org.crsh.plugin.PluginContext
;
import
org.crsh.plugin.PluginLifeCycle
;
import
org.crsh.plugin.ResourceKind
;
import
org.crsh.telnet.term.processor.ProcessorIOHandler
;
import
org.crsh.telnet.term.spi.TermIOHandler
;
import
org.crsh.vfs.Resource
;
import
org.junit.After
;
import
org.junit.Test
;
...
...
@@ -51,10 +53,13 @@ import org.springframework.security.core.AuthenticationException;
import
org.springframework.security.core.authority.SimpleGrantedAuthority
;
import
org.springframework.web.context.support.AnnotationConfigWebApplicationContext
;
import
static
org
.
hamcrest
.
CoreMatchers
.
hasItem
;
import
static
org
.
hamcrest
.
CoreMatchers
.
isA
;
import
static
org
.
hamcrest
.
CoreMatchers
.
not
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertFalse
;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
import
static
org
.
junit
.
Assert
.
assert
Null
;
import
static
org
.
junit
.
Assert
.
assert
That
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
/**
...
...
@@ -63,6 +68,7 @@ import static org.junit.Assert.assertTrue;
* @author Christian Dupuis
* @author Andreas Ahlenstorf
* @author Eddú Meléndez
* @author Matt Benson
*/
@SuppressWarnings
({
"rawtypes"
,
"unchecked"
})
public
class
CrshAutoConfigurationTests
{
...
...
@@ -80,15 +86,18 @@ public class CrshAutoConfigurationTests {
public
void
testDisabledPlugins
()
throws
Exception
{
MockEnvironment
env
=
new
MockEnvironment
();
env
.
setProperty
(
"shell.disabled_plugins"
,
"
GroovyREPL, termIOHandler, org.crsh.auth.AuthenticationPlugin
"
);
"
termIOHandler, org.crsh.auth.AuthenticationPlugin, javaLanguage
"
);
load
(
env
);
PluginLifeCycle
lifeCycle
=
this
.
context
.
getBean
(
PluginLifeCycle
.
class
);
assertNotNull
(
lifeCycle
);
assertNull
(
lifeCycle
.
getContext
().
getPlugin
(
GroovyRepl
.
class
));
assertNull
(
lifeCycle
.
getContext
().
getPlugin
(
ProcessorIOHandler
.
class
));
assertNull
(
lifeCycle
.
getContext
().
getPlugin
(
JaasAuthenticationPlugin
.
class
));
assertThat
(
lifeCycle
.
getContext
().
getPlugins
(
TermIOHandler
.
class
),
not
(
hasItem
(
isA
(
ProcessorIOHandler
.
class
))));
assertThat
(
lifeCycle
.
getContext
().
getPlugins
(
AuthenticationPlugin
.
class
),
not
(
hasItem
(
isA
(
JaasAuthenticationPlugin
.
class
))));
assertThat
(
lifeCycle
.
getContext
().
getPlugins
(
Language
.
class
),
not
(
hasItem
(
isA
(
JavaLanguage
.
class
))));
}
@Test
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment