本文整理汇总了Java中org.springframework.security.access.method.MethodSecurityMetadataSource类的典型用法代码示例。如果您正苦于以下问题:Java MethodSecurityMetadataSource类的具体用法?Java MethodSecurityMetadataSource怎么用?Java MethodSecurityMetadataSource使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MethodSecurityMetadataSource类属于org.springframework.security.access.method包,在下文中一共展示了MethodSecurityMetadataSource类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testDefaultPrePostSecurityAnnotations
import org.springframework.security.access.method.MethodSecurityMetadataSource; //导入依赖的package包/类
@Test
public void testDefaultPrePostSecurityAnnotations() {
this.context = new AnnotationConfigServletWebServerApplicationContext();
this.context.register(AuthorizationAndResourceServerConfiguration.class,
MinimalSecureWebApplication.class);
this.context.refresh();
this.context.getBean(OAuth2MethodSecurityConfiguration.class);
ClientDetails config = this.context.getBean(ClientDetails.class);
DelegatingMethodSecurityMetadataSource source = this.context
.getBean(DelegatingMethodSecurityMetadataSource.class);
List<MethodSecurityMetadataSource> sources = source
.getMethodSecurityMetadataSources();
assertThat(sources.size()).isEqualTo(1);
assertThat(sources.get(0).getClass().getName())
.isEqualTo(PrePostAnnotationSecurityMetadataSource.class.getName());
verifyAuthentication(config);
}
开发者ID:spring-projects,项目名称:spring-security-oauth2-boot,代码行数:18,代码来源:OAuth2AutoConfigurationTests.java
示例2: testClassicSecurityAnnotationOverride
import org.springframework.security.access.method.MethodSecurityMetadataSource; //导入依赖的package包/类
@Test
public void testClassicSecurityAnnotationOverride() {
this.context = new AnnotationConfigServletWebServerApplicationContext();
this.context.register(SecuredEnabledConfiguration.class,
MinimalSecureWebApplication.class);
this.context.refresh();
this.context.getBean(OAuth2MethodSecurityConfiguration.class);
ClientDetails config = this.context.getBean(ClientDetails.class);
DelegatingMethodSecurityMetadataSource source = this.context
.getBean(DelegatingMethodSecurityMetadataSource.class);
List<MethodSecurityMetadataSource> sources = source
.getMethodSecurityMetadataSources();
assertThat(sources.size()).isEqualTo(1);
assertThat(sources.get(0).getClass().getName())
.isEqualTo(SecuredAnnotationSecurityMetadataSource.class.getName());
verifyAuthentication(config, HttpStatus.OK);
}
开发者ID:spring-projects,项目名称:spring-security-oauth2-boot,代码行数:18,代码来源:OAuth2AutoConfigurationTests.java
示例3: testJsr250SecurityAnnotationOverride
import org.springframework.security.access.method.MethodSecurityMetadataSource; //导入依赖的package包/类
@Test
public void testJsr250SecurityAnnotationOverride() {
this.context = new AnnotationConfigServletWebServerApplicationContext();
this.context.register(Jsr250EnabledConfiguration.class,
MinimalSecureWebApplication.class);
this.context.refresh();
this.context.getBean(OAuth2MethodSecurityConfiguration.class);
ClientDetails config = this.context.getBean(ClientDetails.class);
DelegatingMethodSecurityMetadataSource source = this.context
.getBean(DelegatingMethodSecurityMetadataSource.class);
List<MethodSecurityMetadataSource> sources = source
.getMethodSecurityMetadataSources();
assertThat(sources.size()).isEqualTo(1);
assertThat(sources.get(0).getClass().getName())
.isEqualTo(Jsr250MethodSecurityMetadataSource.class.getName());
verifyAuthentication(config, HttpStatus.OK);
}
开发者ID:spring-projects,项目名称:spring-security-oauth2-boot,代码行数:18,代码来源:OAuth2AutoConfigurationTests.java
示例4: initInterceptor
import org.springframework.security.access.method.MethodSecurityMetadataSource; //导入依赖的package包/类
protected void initInterceptor(MethodSecurityInterceptor interceptor) {
MethodSecurityMetadataSource metaDatasource = interceptor.getSecurityMetadataSource();
if (metaDatasource == null) {
String msg = "Configuration error: MethodSecurityInterceptor bean "
+ "has not set an instance SecurityMetadataSource";
log.error(msg);
throw new RuntimeException(msg);
}
if (metaDatasource instanceof CibetDelegatingMethodSecurityMetadataSource) {
return;
}
CibetDelegatingMethodSecurityMetadataSource cibetDel = new CibetDelegatingMethodSecurityMetadataSource();
cibetDel.setOriginalMetadataSource(metaDatasource);
interceptor.setSecurityMetadataSource(cibetDel);
log.debug("replace existing " + metaDatasource.getClass().getName()
+ " against CibetDelegatingMethodSecurityMetadataSource");
}
示例5: testDefaultPrePostSecurityAnnotations
import org.springframework.security.access.method.MethodSecurityMetadataSource; //导入依赖的package包/类
@Test
public void testDefaultPrePostSecurityAnnotations() {
this.context = new AnnotationConfigEmbeddedWebApplicationContext();
this.context.register(AuthorizationAndResourceServerConfiguration.class,
MinimalSecureWebApplication.class);
this.context.refresh();
this.context.getBean(OAuth2MethodSecurityConfiguration.class);
ClientDetails config = this.context.getBean(ClientDetails.class);
DelegatingMethodSecurityMetadataSource source = this.context
.getBean(DelegatingMethodSecurityMetadataSource.class);
List<MethodSecurityMetadataSource> sources = source
.getMethodSecurityMetadataSources();
assertThat(sources.size()).isEqualTo(1);
assertThat(sources.get(0).getClass().getName())
.isEqualTo(PrePostAnnotationSecurityMetadataSource.class.getName());
verifyAuthentication(config);
}
示例6: testClassicSecurityAnnotationOverride
import org.springframework.security.access.method.MethodSecurityMetadataSource; //导入依赖的package包/类
@Test
public void testClassicSecurityAnnotationOverride() {
this.context = new AnnotationConfigEmbeddedWebApplicationContext();
this.context.register(SecuredEnabledConfiguration.class,
MinimalSecureWebApplication.class);
this.context.refresh();
this.context.getBean(OAuth2MethodSecurityConfiguration.class);
ClientDetails config = this.context.getBean(ClientDetails.class);
DelegatingMethodSecurityMetadataSource source = this.context
.getBean(DelegatingMethodSecurityMetadataSource.class);
List<MethodSecurityMetadataSource> sources = source
.getMethodSecurityMetadataSources();
assertThat(sources.size()).isEqualTo(1);
assertThat(sources.get(0).getClass().getName())
.isEqualTo(SecuredAnnotationSecurityMetadataSource.class.getName());
verifyAuthentication(config, HttpStatus.OK);
}
示例7: testJsr250SecurityAnnotationOverride
import org.springframework.security.access.method.MethodSecurityMetadataSource; //导入依赖的package包/类
@Test
public void testJsr250SecurityAnnotationOverride() {
this.context = new AnnotationConfigEmbeddedWebApplicationContext();
this.context.register(Jsr250EnabledConfiguration.class,
MinimalSecureWebApplication.class);
this.context.refresh();
this.context.getBean(OAuth2MethodSecurityConfiguration.class);
ClientDetails config = this.context.getBean(ClientDetails.class);
DelegatingMethodSecurityMetadataSource source = this.context
.getBean(DelegatingMethodSecurityMetadataSource.class);
List<MethodSecurityMetadataSource> sources = source
.getMethodSecurityMetadataSources();
assertThat(sources.size()).isEqualTo(1);
assertThat(sources.get(0).getClass().getName())
.isEqualTo(Jsr250MethodSecurityMetadataSource.class.getName());
verifyAuthentication(config, HttpStatus.OK);
}
示例8: testDefaultPrePostSecurityAnnotations
import org.springframework.security.access.method.MethodSecurityMetadataSource; //导入依赖的package包/类
@Test
public void testDefaultPrePostSecurityAnnotations() {
this.context = new AnnotationConfigEmbeddedWebApplicationContext();
this.context.register(AuthorizationAndResourceServerConfiguration.class,
MinimalSecureWebApplication.class);
this.context.refresh();
this.context.getBean(OAuth2MethodSecurityConfiguration.class);
ClientDetails config = this.context.getBean(ClientDetails.class);
DelegatingMethodSecurityMetadataSource source = this.context
.getBean(DelegatingMethodSecurityMetadataSource.class);
List<MethodSecurityMetadataSource> sources = source
.getMethodSecurityMetadataSources();
assertThat(sources.size(), equalTo(1));
assertThat(sources.get(0).getClass().getName(),
equalTo(PrePostAnnotationSecurityMetadataSource.class.getName()));
verifyAuthentication(config);
}
示例9: testClassicSecurityAnnotationOverride
import org.springframework.security.access.method.MethodSecurityMetadataSource; //导入依赖的package包/类
@Test
public void testClassicSecurityAnnotationOverride() {
this.context = new AnnotationConfigEmbeddedWebApplicationContext();
this.context.register(SecuredEnabledConfiguration.class,
MinimalSecureWebApplication.class);
this.context.refresh();
this.context.getBean(OAuth2MethodSecurityConfiguration.class);
ClientDetails config = this.context.getBean(ClientDetails.class);
DelegatingMethodSecurityMetadataSource source = this.context
.getBean(DelegatingMethodSecurityMetadataSource.class);
List<MethodSecurityMetadataSource> sources = source
.getMethodSecurityMetadataSources();
assertThat(sources.size(), equalTo(1));
assertThat(sources.get(0).getClass().getName(),
equalTo(SecuredAnnotationSecurityMetadataSource.class.getName()));
verifyAuthentication(config, HttpStatus.OK);
}
示例10: testJsr250SecurityAnnotationOverride
import org.springframework.security.access.method.MethodSecurityMetadataSource; //导入依赖的package包/类
@Test
public void testJsr250SecurityAnnotationOverride() {
this.context = new AnnotationConfigEmbeddedWebApplicationContext();
this.context.register(Jsr250EnabledConfiguration.class,
MinimalSecureWebApplication.class);
this.context.refresh();
this.context.getBean(OAuth2MethodSecurityConfiguration.class);
ClientDetails config = this.context.getBean(ClientDetails.class);
DelegatingMethodSecurityMetadataSource source = this.context
.getBean(DelegatingMethodSecurityMetadataSource.class);
List<MethodSecurityMetadataSource> sources = source
.getMethodSecurityMetadataSources();
assertThat(sources.size(), equalTo(1));
assertThat(sources.get(0).getClass().getName(),
equalTo(Jsr250MethodSecurityMetadataSource.class.getName()));
verifyAuthentication(config, HttpStatus.OK);
}
示例11: testMethodSecurityBackingOff
import org.springframework.security.access.method.MethodSecurityMetadataSource; //导入依赖的package包/类
@Test
public void testMethodSecurityBackingOff() {
this.context = new AnnotationConfigServletWebServerApplicationContext();
this.context.register(CustomMethodSecurity.class, TestSecurityConfiguration.class,
MinimalSecureWebApplication.class);
this.context.refresh();
DelegatingMethodSecurityMetadataSource source = this.context
.getBean(DelegatingMethodSecurityMetadataSource.class);
List<MethodSecurityMetadataSource> sources = source
.getMethodSecurityMetadataSources();
assertThat(sources.size()).isEqualTo(1);
assertThat(sources.get(0).getClass().getName())
.isEqualTo(PrePostAnnotationSecurityMetadataSource.class.getName());
}
开发者ID:spring-projects,项目名称:spring-security-oauth2-boot,代码行数:15,代码来源:OAuth2AutoConfigurationTests.java
示例12: execute
import org.springframework.security.access.method.MethodSecurityMetadataSource; //导入依赖的package包/类
public void execute(
DelegatingMethodSecurityMetadataSource delegatingMethodSecurityMetadataSource,
Map<String, String> resourceMap) {
Assert.notNull(delegatingMethodSecurityMetadataSource);
Assert.notNull(resourceMap);
logger.info("refresh method resource");
Map<String, List<ConfigAttribute>> methodMap = null;
methodMap = new LinkedHashMap<String, List<ConfigAttribute>>();
for (Map.Entry<String, String> entry : resourceMap.entrySet()) {
methodMap.put(entry.getKey(), SecurityConfig
.createListFromCommaDelimitedString(entry.getValue()));
}
MethodSecurityMetadataSource source = new MapBasedMethodSecurityMetadataSource(
methodMap);
List<MethodSecurityMetadataSource> sources = new ArrayList<MethodSecurityMetadataSource>();
sources.add(source);
List<MethodSecurityMetadataSource> methodSecurityMetadataSources = delegatingMethodSecurityMetadataSource
.getMethodSecurityMetadataSources();
methodSecurityMetadataSources.clear();
methodSecurityMetadataSources.addAll(sources);
Map attributeCache = (Map) BeanUtils.safeGetFieldValue(
delegatingMethodSecurityMetadataSource, "attributeCache");
attributeCache.clear();
}
示例13: refresh
import org.springframework.security.access.method.MethodSecurityMetadataSource; //导入依赖的package包/类
public void refresh() {
if ((delegatingMethodSecurityMetadataSource == null)
|| (methodSourceFetcher == null)) {
logger.info(
"delegatingMethodSecurityMetadataSource : {}, methodSourceFetcher : {}",
delegatingMethodSecurityMetadataSource, methodSourceFetcher);
return;
}
logger.info("execute refresh");
Map<String, List<ConfigAttribute>> methodMap = null;
methodMap = new LinkedHashMap<String, List<ConfigAttribute>>();
Map<String, String> resourceMap = methodSourceFetcher.getSource(null);
for (Map.Entry<String, String> entry : resourceMap.entrySet()) {
methodMap.put(entry.getKey(), SecurityConfig
.createListFromCommaDelimitedString(entry.getValue()));
}
MethodSecurityMetadataSource source = new MapBasedMethodSecurityMetadataSource(
methodMap);
List<MethodSecurityMetadataSource> sources = new ArrayList<MethodSecurityMetadataSource>();
sources.add(source);
List<MethodSecurityMetadataSource> methodSecurityMetadataSources = delegatingMethodSecurityMetadataSource
.getMethodSecurityMetadataSources();
methodSecurityMetadataSources.clear();
methodSecurityMetadataSources.addAll(sources);
Map attributeCache = (Map) BeanUtils.safeGetFieldValue(
delegatingMethodSecurityMetadataSource, "attributeCache");
attributeCache.clear();
}
示例14: testMethodSecurityBackingOff
import org.springframework.security.access.method.MethodSecurityMetadataSource; //导入依赖的package包/类
@Test
public void testMethodSecurityBackingOff() {
this.context = new AnnotationConfigEmbeddedWebApplicationContext();
this.context.register(CustomMethodSecurity.class, TestSecurityConfiguration.class,
MinimalSecureWebApplication.class);
this.context.refresh();
DelegatingMethodSecurityMetadataSource source = this.context
.getBean(DelegatingMethodSecurityMetadataSource.class);
List<MethodSecurityMetadataSource> sources = source
.getMethodSecurityMetadataSources();
assertThat(sources.size()).isEqualTo(1);
assertThat(sources.get(0).getClass().getName())
.isEqualTo(PrePostAnnotationSecurityMetadataSource.class.getName());
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:15,代码来源:OAuth2AutoConfigurationTests.java
示例15: afterPropertiesSet
import org.springframework.security.access.method.MethodSecurityMetadataSource; //导入依赖的package包/类
@Test
public void afterPropertiesSet() throws Exception {
CibetDelegatingMethodSecurityMetadataSource ms = new CibetDelegatingMethodSecurityMetadataSource();
MethodSecurityMetadataSource msm = SetpointExpressionSecurityMetadataSource
.instance();
ms.setOriginalMetadataSource(msm);
ms.afterPropertiesSet();
}