本文整理匯總了Java中org.springframework.boot.actuate.autoconfigure.ShellProperties.SpringAuthenticationProperties類的典型用法代碼示例。如果您正苦於以下問題:Java SpringAuthenticationProperties類的具體用法?Java SpringAuthenticationProperties怎麽用?Java SpringAuthenticationProperties使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
SpringAuthenticationProperties類屬於org.springframework.boot.actuate.autoconfigure.ShellProperties包,在下文中一共展示了SpringAuthenticationProperties類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: springAuthenticationProperties
import org.springframework.boot.actuate.autoconfigure.ShellProperties.SpringAuthenticationProperties; //導入依賴的package包/類
@Bean
@ConditionalOnMissingBean(CrshShellAuthenticationProperties.class)
public SpringAuthenticationProperties springAuthenticationProperties() {
// In case no management.shell.auth.type property is provided fall back to
// Spring Security based authentication and get role to access shell from
// ManagementServerProperties.
// In case management.shell.auth.type is set to spring and roles are
// configured using shell.auth.spring.roles the below default role will be
// overridden by ConfigurationProperties.
SpringAuthenticationProperties authenticationProperties = new SpringAuthenticationProperties();
if (this.management != null) {
List<String> roles = this.management.getSecurity().getRoles();
authenticationProperties
.setRoles(roles.toArray(new String[roles.size()]));
}
return authenticationProperties;
}
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:18,代碼來源:CrshAutoConfiguration.java
示例2: springAuthenticationProperties
import org.springframework.boot.actuate.autoconfigure.ShellProperties.SpringAuthenticationProperties; //導入依賴的package包/類
@Bean
@ConditionalOnMissingBean(CrshShellAuthenticationProperties.class)
public SpringAuthenticationProperties springAuthenticationProperties() {
// In case no shell.auth property is provided fall back to Spring Security
// based authentication and get role to access shell from
// ManagementServerProperties.
// In case shell.auth is set to spring and roles are configured using
// shell.auth.spring.roles the below default role will be overridden by
// ConfigurationProperties.
SpringAuthenticationProperties authenticationProperties = new SpringAuthenticationProperties();
if (this.management != null) {
authenticationProperties.setRoles(
new String[] { this.management.getSecurity().getRole() });
}
return authenticationProperties;
}
示例3: testBindingSpring
import org.springframework.boot.actuate.autoconfigure.ShellProperties.SpringAuthenticationProperties; //導入依賴的package包/類
@Test
public void testBindingSpring() {
SpringAuthenticationProperties props = load(SpringAuthenticationProperties.class,
"management.shell.auth.spring.roles=role1,role2");
Properties p = new Properties();
props.applyToCrshShellConfig(p);
assertThat(p.get("crash.auth.spring.roles")).isEqualTo("role1,role2");
}
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:9,代碼來源:ShellPropertiesTests.java
示例4: testBindingSpring
import org.springframework.boot.actuate.autoconfigure.ShellProperties.SpringAuthenticationProperties; //導入依賴的package包/類
@Test
public void testBindingSpring() {
SpringAuthenticationProperties props = new SpringAuthenticationProperties();
RelaxedDataBinder binder = new RelaxedDataBinder(props, "shell.auth.spring");
binder.bind(new MutablePropertyValues(
Collections.singletonMap("shell.auth.spring.roles", "role1, role2")));
assertFalse(binder.getBindingResult().hasErrors());
Properties p = new Properties();
props.applyToCrshShellConfig(p);
assertEquals("role1, role2", p.get("crash.auth.spring.roles"));
}