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


Java BeanIds类代码示例

本文整理汇总了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;未经允许,请勿转载。