• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java BeanIds类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.springframework.security.config.BeanIds的典型用法代码示例。如果您正苦于以下问题:Java BeanIds类的具体用法?Java BeanIds怎么用?Java BeanIds使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



BeanIds类属于org.springframework.security.config包,在下文中一共展示了BeanIds类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: testMethodAndRoleMapping

import org.springframework.security.config.BeanIds; //导入依赖的package包/类
/**
 * 메소드 접근 제어 권한에 따른 Role 맵핑을 처리함
 * 메소드 수행이 허용된 메소드 실행 시 성공 테스트
 * @throws Exception
 */
@Test
public void testMethodAndRoleMapping() throws Exception {
	
	DelegatingMethodDefinitionSource definitionsource = (DelegatingMethodDefinitionSource) context.getBean(BeanIds.DELEGATING_METHOD_DEFINITION_SOURCE);
	Method method = null;
	ConfigAttributeDefinition role = null;
	
	// test1 : matched role
	try {
		method = CategoryController.class.getMethod("selectCategoryList", null);
	} catch (NoSuchMethodException nsme) {
		log.error("## testMethodAndRoleMapping : ", nsme);
	}

	role = definitionsource.getAttributes(method, CategoryController.class);

	assertEquals("ROLE_USER", role.getConfigAttributes().toArray()[0].toString());
	log.debug("## testMethodAndRoleMapping : " + method.getName() + " is " + role.getConfigAttributes().toArray()[0].toString());

}
 
开发者ID:eGovFrame,项目名称:egovframework.rte.root,代码行数:26,代码来源:EgovSecurityServiceTest.java


示例2: testFailedMethodAndRoleMapping

import org.springframework.security.config.BeanIds; //导入依赖的package包/类
/**
 * 메소드 수행이 허용되지 않은 메소드 실행 시 실패 테스트
 * @throws Exception
 */
@Test
public void testFailedMethodAndRoleMapping() throws Exception {
	
	DelegatingMethodDefinitionSource definitionsource = (DelegatingMethodDefinitionSource) context.getBean(BeanIds.DELEGATING_METHOD_DEFINITION_SOURCE);
	Method method = null;
	ConfigAttributeDefinition role = null;
	
	// test1 : no matched role
	try {
		method = CategoryController.class.getMethod("addCategoryView", null);
	} catch (NoSuchMethodException nsme) {
		log.error("## testMethodAndRoleMapping : ", nsme);
	}

	role = definitionsource.getAttributes(method, CategoryController.class);

	assertEquals(null, role);
	log.debug("## testMethodAndRoleMapping : " + method.getName() + " is no roles");
}
 
开发者ID:eGovFrame,项目名称:egovframework.rte.root,代码行数:24,代码来源:EgovSecurityServiceTest.java


示例3: findDefaultFilterChainBeanId

import org.springframework.security.config.BeanIds; //导入依赖的package包/类
@SuppressWarnings({"unchecked"})
protected static String findDefaultFilterChainBeanId(ParserContext parserContext) {
  BeanDefinition filterChainList = parserContext.getRegistry().getBeanDefinition(BeanIds.FILTER_CHAINS);
  // Get the list of SecurityFilterChain beans
  List<BeanReference> filterChains = (List<BeanReference>)
            filterChainList.getPropertyValues().getPropertyValue("sourceList").getValue();

  return filterChains.get(filterChains.size() - 1).getBeanName();
}
 
开发者ID:jungyang,项目名称:oauth-client-master,代码行数:10,代码来源:ConfigUtils.java


示例4: afterPropertiesSet

import org.springframework.security.config.BeanIds; //导入依赖的package包/类
public void afterPropertiesSet() throws Exception {
    Assert.notNull(this.applicationContext, "applicationContext is null");

    if (null == authentificationManager) {
        setAuthentificationManager((AuthenticationManager) applicationContext.getBean(BeanIds.AUTHENTICATION_MANAGER));
    }
    filterChainProxy = applicationContext.getBean(BeanIds.FILTER_CHAIN_PROXY, FilterChainProxy.class);
}
 
开发者ID:devacfr,项目名称:spring-restlet,代码行数:9,代码来源:SpringSecurityGuard.java


示例5: testRejectAccessForUnauthorizedUser

import org.springframework.security.config.BeanIds; //导入依赖的package包/类
/**
 * DB에 등록된 사용자의 인증 실패 테스트
 * @throws Exception
 */
@Test
@ExpectedException(BadCredentialsException.class)
public void testRejectAccessForUnauthorizedUser() throws Exception {
   
   UsernamePasswordAuthenticationToken login = new UsernamePasswordAuthenticationToken("jimi", "wrongpw");
   AuthenticationManager authManager =
   	(AuthenticationManager) context.getBean(BeanIds.AUTHENTICATION_MANAGER);
   
   log.debug("### jimi's password is wrong!!");
   SecurityContextHolder.getContext().setAuthentication(authManager.authenticate(login));
   
}
 
开发者ID:eGovFrame,项目名称:egovframework.rte.root,代码行数:17,代码来源:EgovSecurityServiceTest.java


示例6: authenticationManagerBean

import org.springframework.security.config.BeanIds; //导入依赖的package包/类
@Bean(name = BeanIds.AUTHENTICATION_MANAGER)
@Override
public AuthenticationManager authenticationManagerBean() throws Exception {
	return super.authenticationManagerBean();
}
 
开发者ID:activeviam,项目名称:autopivot,代码行数:6,代码来源:SecurityConfig.java


示例7: authenticationManagerBean

import org.springframework.security.config.BeanIds; //导入依赖的package包/类
@Bean(name = BeanIds.AUTHENTICATION_MANAGER)
@Override
public AuthenticationManager authenticationManagerBean() throws Exception {
    return super.authenticationManagerBean();
}
 
开发者ID:izhangzhihao,项目名称:SSMSeedProject,代码行数:6,代码来源:SecurityConfig.java


示例8: testSuccessfulUrlInvocation

import org.springframework.security.config.BeanIds; //导入依赖的package包/类
/**
 * 웹 접근이 허용된 URL로 접근 시 Context 에서 지정한 로그인 화면으로 이동됨 검사
 * @throws Exception
 */
@Test
public void testSuccessfulUrlInvocation() throws Exception {

	final String loginPage = "/cvpl/EgovCvplLogin.do";
	
	FilterChainProxy filterChainProxy = (FilterChainProxy) context.getBean(BeanIds.FILTER_CHAIN_PROXY);

	
	////////////////
    MockHttpServletRequest request = new MockHttpServletRequest();
    request.setMethod("GET");
    request.setServletPath("/test.do");

	MockHttpServletResponse response = new MockHttpServletResponse();
	MockFilterChain chain = new MockFilterChain();

	filterChainProxy.doFilter(request, response, chain);
	
	assertTrue(response.getRedirectedUrl().indexOf(loginPage) >= 0);
	log.debug("### getRedirectedUrl " + response.getRedirectedUrl());
	log.debug("### getForwardedUrl " + response.getForwardedUrl());
	log.debug("### getIncludedUrl " + response.getIncludedUrl());
	log.debug("### getErrorMessage " + response.getErrorMessage());
	log.debug("### getContentAsString " + response.getContentAsString());


	/////////////
	request = new MockHttpServletRequest();
    request.setMethod("GET");
    request.setServletPath("/sale/index.do");

	response = new MockHttpServletResponse();

	filterChainProxy.doFilter(request, response, chain);
	
	assertTrue(response.getRedirectedUrl().indexOf(loginPage) >= 0);
	log.debug("### getRedirectedUrl " + response.getRedirectedUrl());
	log.debug("### getForwardedUrl " + response.getForwardedUrl());
	log.debug("### getIncludedUrl " + response.getIncludedUrl());
	log.debug("### getErrorMessage " + response.getErrorMessage());
	log.debug("### getContentAsString " + response.getContentAsString());

}
 
开发者ID:eGovFrame,项目名称:egovframework.rte.root,代码行数:48,代码来源:EgovSecurityServiceTest.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java LeftJoin类代码示例发布时间:2022-05-22
下一篇:
Java SystemTray类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap