当前位置: 首页>>代码示例>>Java>>正文


Java SpringAuthenticationProperties类代码示例

本文整理汇总了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;
}
 
开发者ID:Nephilim84,项目名称:contestparser,代码行数:17,代码来源:CrshAutoConfiguration.java

示例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"));
}
 
开发者ID:Nephilim84,项目名称:contestparser,代码行数:14,代码来源:ShellPropertiesTests.java


注:本文中的org.springframework.boot.actuate.autoconfigure.ShellProperties.SpringAuthenticationProperties类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。