2014-12-30 4 views
0

@WebService으로 게시 된 세션 빈을 사용하여 응용 프로그램 서버 도메인/보안 영역을 통해 HTTP Basic을 인증하려면 어떻게해야합니까?EJB JAX-WS 웹 서비스 인증 및 권한 부여

웹 프로젝트에서 web.xml을 사용하여 역할을 그룹에 매핑 할 수 있지만 EJB-JAR 프로젝트에서이를 수행하는 방법을 모릅니다. 나는 그것이 ejb-jar.xml과 함께 할 수 있다고 생각하지 않는다.

@Stateless 
@WebService(portName="RestrictedServicePort") 
@DeclareRoles(value = "Administrators") 
public class RestrictedServiceBean { 

    @RolesAllowed(value = "Administrators") 
    public String restrictedOperation() { 
     return "Secret information";   
    } 

} 

오류 :

<faultstring>[EJB:010160]Security Violation: User: '&lt;anonymous>' has insufficient permission to access EJB: type=&lt;ejb> 

기본 자격 증명 헤더 : 역할 주석없이 잘 작동

샘플 코드,

Authorization: Basic d2VibG9naWM6d2VsY29tZTE=

을 내가 그것을 수행해야합니다 의심 공급 업체별 구성을 통해 WebLogic 10.3.6, Java EE 5/EJB 3.0을 사용하고 있습니다. 정책을 통해

답변

0

다음과 같이이 모든 웹 모듈에서 수행되는 것처럼 역할 매핑을 추가하지만, 독점 웹 로직에서 EJB-jar.xml의를 사용하여 해결 :

<wls:security-role-assignment> 
    <wls:role-name>Administrators</wls:role-name> 
    <wls:principal-name>myweblogicgroup</wls:principal-name> 
</wls:security-role-assignment> 

은 "myweblogicgroup은"만든 그룹이다 시스템 사용자가 웹 서비스에 인증하는 데 사용한 WebLogic 보안 영역에서.

This link 나를 도왔습니다.

1

기본 인증 v10 docs에서

:

<sp:TransportToken> 
    <wsp:Policy> 
    <sp:HttpBasicAuthentication/> 
    </wsp:Policy> 
</sp:TransportToken> 

당신은을 통해이 사용자 정의 정책을 적용 할 수 있습니다 :

A Web service can have zero or more WS-Policy files associated with it. WS-Policy files follow the guidelines of the WS-Policy specification. WebLogic Server uses WS-Policy files to specify the details of the message-level security (digital signatures and encryption) and reliable messaging capabilities of a Web service. You can attach a WS-Policy file to a Web service endpoint, which means that the policy assertions apply to all the operations of a Web service endpoint. You can also attach a WS-Policy file to an operation, which means that the policy assertions apply only to the specific operation. In addition, you can attach a WS-Policy file to the inbound or outbound SOAP message, or both.

당신이 당신의 서비스에 attach a basic auth policy 수 있습니다 나타납니다 관리 콘솔을 통해 here 단계를 설명하거나 고려할 수 있습니다. r은 Oracle-preconfigured policies 중 하나를 참조합니다. 언급 documentation 그룹

웹 로직 (V12)에


매핑 역할은 EJB에 @RolesAllowed의 사용을 논의 할 때 다음

You can also use the annotation to explicitly declare roles that are implicitly declared if you use the @RolesAllowed annotation on the class or a method of the class.

You create security roles in WebLogic Server using the Administration Console. For details, see " Manage Security Roles " in the Oracle WebLogic Server Administration Console Help.

Manage Security Roles 섹션 scoped roles.을 논의하기에 계속

You can then create a scoped role for a specific EJB that contains highly sensitive business logic. When you create a policy for the EJB, you can specify that only the scoped role can access the EJB.

범위가 지정된 역할을 관리하는 방법에 대한 자세한 내용은 here입니다.

+0

답변은 내 질문의 HTTP 인증 측면과 관련이 없습니다.내 문제는, 세션 빈에서 선언되고 AS에서 생성 된 역할조차도 WebLogic은 기본 자격 증명으로 인증하지 않는다는 것입니다. 간단한 HTTP 기본 인증처럼 애플리케이션 서버 기능을 사용할 수없는 경우 JAX-WS로 EJB를 게시하는 목적은 무엇입니까? 나는 그것이 통합되기를 기대할 것이다. – BonanzaOne

+0

사과, 내가 그룹에 역할을 매핑에 관한 질문의 진술에 열쇠. 기본 인증에 대한 답변을보다 구체적으로 업데이트하겠습니다. –

+0

지연에 대해 유감스럽게 생각했지만 제가 시도한 몇 가지 시도에서 제안을 적용하는 데 성공하지 못했습니다. 방금 게시 한 답변을 사용하여 웹 서비스를 보호 할 수있었습니다. – BonanzaOne