2016-09-15 6 views
0

Karaf 4.0.4에서 OSGI 응용 프로그램을 실행합니다. 이 응용 프로그램은 웹 응용 프로그램이 아닙니다.OSGI의 Shiro 주석

SQL 데이터베이스에 저장된 자격 증명을 사용하는 사용자 지정 SecurityRealm을 사용하여 로그인하려면 Apache Shiro를 구성했습니다. SecurityManager 및 영역은 청사진 을 사용하여 구성됩니다.이 부분은 정상적으로 작동합니다. 그 annoations 평가되지 않습니다

@RequiresPermissions("doSomething") 
@RequiresRoles("admin") 
public void myMethodToDoSomething() { 
    ... 
} 

:

내가 좋아하는 주석을 사용하고 싶습니다. . (내 보안 영역 protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) 메소드가 호출되지 않습니다

을 몇 시로 설명서를 읽은 후, 나는 그것이 시로 봄에 정의 된 것 같이 내가 필요한 인터셉터가 없기 때문에 작동하지 않습니다 이해 turorial :

<!-- Enable Shiro Annotations for Spring-configured beans. Only run after --> 
<!-- the lifecycleBeanProcessor has run: --> 
<bean class="org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator" depends-on="lifecycleBeanPostProcessor"/> 
<bean class="org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor"> 
<property name="securityManager" ref="securityManager"/> 

하지만 내 응용 프로그램에 스프링을 사용하지 않는 등, 그 라인이 작동하지 않습니다.

답변

2

을 당신은 청사진 네임 스페이스 모듈을 만들 수 있습니다. 이것은 다음 인터셉터를 설치하는 청사진 콩에 연결할 수 있습니다. 마찬가지로 예 : blueprint-authz module을 참조하십시오.

+0

어떻게 이런 종류의 모듈을 설치합니까? 보통 사람처럼? – jhamon

+0

예. 그것은 단지 묶음입니다. –

+0

다음은 청사진 파일의 모습입니다. https://github.com/apache/aries/blob/trunk/blueprint/blueprint-itests/src/test/resources/authz.xml –