2011-01-06 14 views
0

私は非常に単純なタスクを達成するために - 私はWebサービスのセキュリティ(WLESユーザーIDとパスワードでハードコードされた基本認証)を設定する必要があります。私はweb.xmlを設定しましたが(以下のコード部分を参照してください)、WebLogicの設定には苦労します。私はIdentityAssertionAuthenticator認証プロバイダを追加し、必須として設定し、DefaultAuthenticatorをオプションとして変更して、アプリケーションのセキュリティをデプロイして "thisIsUser"にロールを設定しましたが、それはもう機能しませんでした(warファイルを再デプロイし、同じ方法だが役に立たない)。私はあなたのすべての助けを大いに感謝します。 web.xmlのWebLogic 10.3.3の設定方法。 JAX_WS Webサービスのセキュリティ

<?xml version="1.0" encoding="UTF-8"?> 
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" 
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" 
    id="PC3-WS" version="2.5"> 
    <display-name>PC3-WS</display-name> 
    <session-config> 
     <session-timeout>30</session-timeout> 
    </session-config> 
    <security-constraint> 
     <display-name>SecurityConstraint</display-name> 
     <web-resource-collection> 
      <web-resource-name>PC3-WS</web-resource-name> 
      <url-pattern>/PC3-WS</url-pattern> 

     </web-resource-collection> 

     <auth-constraint> 
      <role-name>basicGroup</role-name> 
     </auth-constraint> 
     <user-data-constraint> 
      <transport-guarantee>NONE</transport-guarantee> 
     </user-data-constraint> 

    </security-constraint> 

    <security-role> 
     <role-name>basicGroup</role-name> 
    </security-role> 

    <login-config> 
     <auth-method>BASIC</auth-method> 
     <realm-name>myrealm</realm-name> 
    </login-config> 
</web-app> 

のweblogic.xml:

<?xml version="1.0" encoding="UTF-8"?> 
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" 
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" 
    id="PC3-WS" version="2.5"> 
    <display-name>PC3-WS</display-name> 
    <session-config> 
     <session-timeout>30</session-timeout> 
    </session-config> 
    <security-constraint> 
     <display-name>SecurityConstraint</display-name> 
     <web-resource-collection> 
      <web-resource-name>PC3-WS</web-resource-name> 
      <url-pattern>/PC3-WS</url-pattern> 

     </web-resource-collection> 

     <auth-constraint> 
      <role-name>basicGroup</role-name> 
     </auth-constraint> 
     <user-data-constraint> 
      <transport-guarantee>NONE</transport-guarantee> 
     </user-data-constraint> 

    </security-constraint> 

    <security-role> 
     <role-name>basicGroup</role-name> 
    </security-role> 

    <login-config> 
     <auth-method>BASIC</auth-method> 
     <realm-name>myrealm</realm-name> 
    </login-config> 
</web-app> 

認証者リスト:

  • DefaultAuthenticatorを
  • DefaultIdentityAssert

今、私ヘクタールVEの例外:

WS spec-version:2.5], request: [email protected][ 
GET /PC3-WS/MetadataService?WSDL HTTP/1.1 
User-Agent: Java1.6.0_22 
Accept: text/html, image/gif, image/jpeg, */*; q=.2 
Connection: Keep-Alive 

]] Root cause of ServletException. 
java.lang.NullPointerException 
    at weblogic.wsee.jaxws.JAXWSDeployedServlet.init(JAXWSDeployedServlet.java:45) 
    at javax.servlet.GenericServlet.init(GenericServlet.java:241) 
    at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.run(StubSecurityHelper.java:283) 
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321) 
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121) 
    Truncated. see log file for complete stacktrace 
> 
java.lang.RuntimeException: weblogic.testclient.WsdlParseFailedException: Unable to parse WSDl at: http://192.168.1.3:7001/PC3-WS/MetadataService?WSDL 
    at weblogic.testclient.ConnectionState.createWsdl(ConnectionState.java:69) 
    at Controller.refreshWsdl(Controller.java:641) 
    at Controller.begin(Controller.java:451) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
    at java.lang.reflect.Method.invoke(Method.java:597) 
    at org.apache.beehive.netui.pageflow.FlowController.invokeActionMethod(FlowController.java:879) 
    at org.apache.beehive.netui.pageflow.FlowController.getActionMethodForward(FlowController.java:809) 
    at org.apache.beehive.netui.pageflow.FlowController.internalExecute(FlowController.java:478) 
    at org.apache.beehive.netui.pageflow.PageFlowController.internalExecute(PageFlowController.java:306) 
    at org.apache.beehive.netui.pageflow.FlowController.execute(FlowController.java:336) 
    at org.apache.beehive.netui.pageflow.internal.FlowControllerAction.execute(FlowControllerAction.java:52) 
    at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431) 
    at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.access$201(PageFlowRequestProcessor.java:97) 
    at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor$ActionRunner.execute(PageFlowRequestProcessor.java:2044) 
    at org.apache.beehive.netui.pageflow.interceptor.action.internal.ActionInterceptors.wrapAction(ActionInterceptors.java:91) 
    at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.processActionPerform(PageFlowRequestProcessor.java:2116) 
    at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236) 
    at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.processInternal(PageFlowRequestProcessor.java:556) 
    at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.process(PageFlowRequestProcessor.java:853) 
    at org.apache.beehive.netui.pageflow.AutoRegisterActionServlet.process(AutoRegisterActionServlet.java:631) 
    at org.apache.beehive.netui.pageflow.PageFlowActionServlet.process(PageFlowActionServlet.java:158) 
    at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414) 
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:707) 
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:820) 
    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227) 
    at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125) 
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300) 
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:183) 
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.doIt(WebAppServletContext.java:3683) 
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3650) 
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321) 
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121) 
    at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2268) 
    at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2174) 
    at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1446) 
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201) 
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:173) 
Caused by: weblogic.testclient.WsdlParseFailedException: Unable to parse WSDl at: http://192.168.1.3:7001/PC3-WS/MetadataService?WSDL 
    at weblogic.testclient.ConnectionState.createWsdlFromHttpUrl(ConnectionState.java:199) 
    at weblogic. 

testclient.ConnectionState.createWsdl(ConnectionState.java:60) ...もっと38は

答えて

1

これは、WLES 10.3.3の基本HTTP認証でWebサービスを保護する方法です。 WLES管理コンソールで

は、セキュリティレルムに行く - > MYREALMと作成:

新しいユーザをユーザ/ 12345678 新グループ:basicGroup はウェブでグループ

にユーザーを追加します。XMLは、セキュリティ設定(パス、基本型)を追加します。

<?xml version="1.0" encoding="UTF-8"?> 
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" 
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" 
    id="PC3-WS" version="2.5"> 
    <display-name>PC3-WS</display-name> 
    <session-config> 
     <session-timeout>30</session-timeout> 
    </session-config> 
    <security-constraint> 
     <display-name>SecurityConstraint</display-name> 
     <web-resource-collection> 
      <web-resource-name>PC3-WS</web-resource-name> 
      <url-pattern>/PC3-WS</url-pattern> 
     </web-resource-collection> 
     <auth-constraint> 
      <role-name>basicGroup</role-name> 
     </auth-constraint> 
     <user-data-constraint> 
      <transport-guarantee>NONE</transport-guarantee> 
     </user-data-constraint> 
    </security-constraint> 
    <security-role> 
     <role-name>Authenticated</role-name> 
    </security-role> 

    <login-config> 
     <auth-method>BASIC</auth-method> 
     <realm-name>myrealm</realm-name> 
    </login-config> 
</web-app> 

では(これは必須です)サーバーの役割を持つアプリケーション・ロールをマップするweblogic.xml:

<?xml version="1.0" encoding="UTF-8"?> 
<wls:weblogic-web-app 
    xmlns:wls="http://xmlns.oracle.com/weblogic/weblogic-web-app" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd http://xmlns.oracle.com/weblogic/weblogic-web-app http://xmlns.oracle.com/weblogic/weblogic-web-app/1.1/weblogic-web-app.xsd"> 
    <wls:weblogic-version>10.3.3</wls:weblogic-version> 
    <wls:context-root>PC3-WS</wls:context-root> 
    <wls:security-role-assignment> 
     <wls:role-name>Authenticated</wls:role-name> 
     <wls:principal-name>users</wls:principal-name> 
    </wls:security-role-assignment> 
</wls:weblogic-web-app> 

アプリケーションをビルドして展開します。 WLESを再起動します。 SoapUIを使用してテストすることができます。ユーザーIDとパスワードを「認証とセキュリティ関連の設定」の下のセクションに渡します。 ファイル→環境設定に移動し、「HTTP設定」で「プリエンプティブに認証する」をチェックします WebサービスsoapUIから。

1
  1. は、あなたが完全なweb.xmlの& weblogic.xmlのファイルを提供することはできますか?
  2. 基本認証だけを行う場合、なぜIdentityAssertionAuthenticatorを設定する必要がありますか?
  3. また、あなたはサーバーの概要を持っているものをオーセンティケータの提供することができます> MYREALM>プロバイダ(コンソールから)

認証はコンソールで

をtriggedなっている場合最後に、トレースするデバッグを有効にすることができます>%YOUR_SERVER%>デバッグ

は、WebLogic>セキュリティを拡張し、

を有効にするサーバーの

概要に移動します

  • DebugSecurity
  • ATN> DebugSecurityAtn

ちょうどあなたがデバッグモードでログを持っていることを確認。アプリをテストし、サーバログを見て、何が起きているかの詳細を提供する必要があります。

+0

私の質問の本文にweb.xmlとweblogic.xmlを追加しました。あなたの助けに感謝します。 –

関連する問題