Return-Path: X-Original-To: apmail-chemistry-dev-archive@www.apache.org Delivered-To: apmail-chemistry-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id CBD88DE36 for ; Tue, 6 Nov 2012 15:18:14 +0000 (UTC) Received: (qmail 28821 invoked by uid 500); 6 Nov 2012 15:18:14 -0000 Delivered-To: apmail-chemistry-dev-archive@chemistry.apache.org Received: (qmail 28635 invoked by uid 500); 6 Nov 2012 15:18:14 -0000 Mailing-List: contact dev-help@chemistry.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@chemistry.apache.org Delivered-To: mailing list dev@chemistry.apache.org Received: (qmail 28262 invoked by uid 99); 6 Nov 2012 15:18:12 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 06 Nov 2012 15:18:12 +0000 X-ASF-Spam-Status: No, hits=2.6 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS,TRACKER_ID,WEIRD_PORT X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of schivukula@gmail.com designates 74.125.82.42 as permitted sender) Received: from [74.125.82.42] (HELO mail-wg0-f42.google.com) (74.125.82.42) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 06 Nov 2012 15:18:03 +0000 Received: by mail-wg0-f42.google.com with SMTP id fm10so2559843wgb.1 for ; Tue, 06 Nov 2012 07:17:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=ozotdt/73eNK+K8jUXMp6cEFy/2nw6anpxfJQm2xpCU=; b=obHi2oYnaN7PvlfS3nITbb1VbRryN5PeLvJ5saS4pd16cyWEy2r8ZFcDgqpJx8XZZG d9HvLiTqgrBNlmMCAWBgxS+HKDFthekdC4C9YbwnM+xwwfawASa564rzIYER8MawA/1i 0WefmYUuJZFog4P8dDDqzid321ZE1MnWCVo1Yo+4qG51j8cvzMxS3K5AUAR+m9w6GKov FF3XoM6djASvsi8O00YbqWlXtof6C60H+jpLJ24Px9oKDNA1qy/sRz93oXW8Tj07jQKI l1oliNxUxQnKhI+F/6qrNfv2u2xFOjSzLjO2cZoIrSVoVybsqIk8F+xBOlp+iKvXK64w PMQg== Received: by 10.180.107.136 with SMTP id hc8mr2767473wib.9.1352215063218; Tue, 06 Nov 2012 07:17:43 -0800 (PST) MIME-Version: 1.0 Received: by 10.216.95.198 with HTTP; Tue, 6 Nov 2012 07:17:02 -0800 (PST) In-Reply-To: <5092D775.2090905@apache.org> References: <5a5e729e0ddcaea346482c9cff937d02-EhVcXl9JQQFXRwQFDQkEXR0wfgZLV15fQUBFBEFYXS9ZUF0WWlloB11LX15bLkQBWlteQFlTWA0=-webmailer2@server03.webmailer.hosteurope.de> <5092D775.2090905@apache.org> From: Srinivas Chivukula Date: Tue, 6 Nov 2012 10:17:02 -0500 Message-ID: Subject: Re: Fwd: how to send any element in wsse usernametoken To: =?ISO-8859-1?Q?Florian_M=FCller?= Cc: dev@chemistry.apache.org Content-Type: multipart/alternative; boundary=e89a8f3bad4580cb6c04cdd51ab3 X-Virus-Checked: Checked by ClamAV on apache.org --e89a8f3bad4580cb6c04cdd51ab3 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hello Florian, Do we have any example for the custom authentication?, I tried to create custom authentication and use that but I am getting error that its missing credentials public static final String CUSTOM_AUTHENTICATION_PROVIDER =3D "com.eohhs.cmis.example.MyAuthenticationProvider"; parameter.put(SessionParameter.AUTHENTICATION_PROVIDER_CLASS,CUSTOM_AUTHENT= ICATION_PROVIDER); parameter.put("com.eohhs.cmis.example.user", "testuser"); // MyAuthenticationProvider can get and evaluate this parameter.put("com.eohhs.cmis.example.password", "testpassword"); parameter.put(SessionParameter.BINDING_TYPE, BindingType.WEBSERVICES.value()); thanks Srinivas *MyAuthenticationProvider - Class* package com.eohhs.cmis.example; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import org.apache.chemistry.opencmis.client.bindings.spi.AbstractAuthenticationPro= vider; public class MyAuthenticationProvider extends AbstractAuthenticationProvider { public String user, password; @Override public Map> getHTTPHeaders(String url) { Map> result =3D new HashMap>(); // get user and password user =3D getUser(); password =3D getPassword(); String appId=3D"testappid"; List lUser =3D new ArrayList(); List lPwd =3D new ArrayList(); List lappID =3D new ArrayList(); lUser.add(user); lPwd.add(password); lappID.add(appId); result.put(org.apache.chemistry.opencmis.commons.SessionParameter.USER, lUser); result.put(org.apache.chemistry.opencmis.commons.SessionParameter.PASSWORD= , lPwd); result.put("mass.gov.eohhs.edm.edmAppID", lappID); return result; //return super.getHTTPHeaders(url); } } On Thu, Nov 1, 2012 at 4:11 PM, Florian M=FCller wrote: > Hi Srinivas, > > It looks like your server is using Basic Authentication (or something > similar). The status code 401 is not returned by the Web Services server, > but by some other component that looks at the HTTP headers. Is this > intentional? Do you have any reverse proxy in front of your service or so= me > SSO setup in place? > > It may also use UsernameTokens but it doesn't seem to reach that check. > OpenCMIS does also send Basic Authentication credentials, but it assumes > that the UsernameTokens credentials and the Basic Authentication > credentials are the same. If that's not the case, you have to code that > into your own authentication provider. > > > Florian > > > Hello Florian, >> Thanks for the info, I still have some issue, I cant get the cmis client >> to >> send the username and password at all, I get authorization failed, below >> is >> the snippet of the code. please let me know if you see anything incorrec= t, >> the user and password work fine if I use it in SoapUI, I checked the soa= p >> xml at the CMIS Webservice and it does not have username and password ta= g >> coming in at all >> thanks >> Srinivas >> >> SessionFactory f =3D SessionFactoryImpl.**newInstance(); >> Map parameter =3D new HashMap(); >> String wsdl =3D "http://IP:8100/cmis/services/**RepositoryService?wsdl= >> "; >> parameter.put(**SessionParameter.USER, "username"); >> parameter.put(**SessionParameter.PASSWORD, "password"); >> parameter.put(**SessionParameter.BINDING_TYPE, >> BindingType.WEBSERVICES.value(**)); >> parameter.put(**SessionParameter.WEBSERVICES_**ACL_SERVICE, wsdl); >> parameter.put(**SessionParameter.WEBSERVICES_**DISCOVERY_SERVICE, >> wsdl); >> parameter.put(**SessionParameter.WEBSERVICES_**MULTIFILING_SERVICE, >> wsdl); >> parameter.put(**SessionParameter.WEBSERVICES_**NAVIGATION_SERVICE, >> wsdl); >> parameter.put(**SessionParameter.WEBSERVICES_**OBJECT_SERVICE, wsdl); >> parameter.put(**SessionParameter.WEBSERVICES_**POLICY_SERVICE, wsdl); >> parameter.put(**SessionParameter.WEBSERVICES_**RELATIONSHIP_SERVICE, >> wsdl); >> parameter.put(**SessionParameter.WEBSERVICES_**REPOSITORY_SERVICE, >> wsdl); >> parameter.put(**SessionParameter.WEBSERVICES_**VERSIONING_SERVICE, wsdl)= ; >> parameter.put(**SessionParameter.REPOSITORY_**ID, "repo_dev"); >> Session s =3D f.createSession(parameter); >> System.out.println("CMISTest.**main()"+s.getRepositoryInfo())**; >> System.out.println("done!"); >> >> Error: >> Exception in thread "main" >> org.apache.chemistry.opencmis.**commons.exceptions.** >> CmisRuntimeException: >> Error: The server sent HTTP status code 401: Unauthorized >> at >> org.apache.chemistry.opencmis.**client.bindings.spi.**webservices.** >> RepositoryServiceImpl.**getRepositoryInfos(** >> RepositoryServiceImpl.java:76) >> at >> org.apache.chemistry.opencmis.**client.bindings.impl.** >> RepositoryServiceImpl.**getRepositoryInfos(** >> RepositoryServiceImpl.java:85) >> at >> org.apache.chemistry.opencmis.**client.runtime.**SessionFactoryImpl.** >> getRepositories(**SessionFactoryImpl.java:111) >> at >> org.apache.chemistry.opencmis.**client.runtime.**SessionFactoryImpl.** >> getRepositories(**SessionFactoryImpl.java:98) >> at com.eohhs.cmis.example.**CMISTest.main(CMISTest.java:**66) >> Caused by: com.sun.xml.ws.client.**ClientTransportException: The server >> sent >> HTTP status code 401: Unauthorized >> at >> com.sun.xml.ws.transport.http.**client.HttpTransportPipe.** >> checkStatusCode(**HttpTransportPipe.java:203) >> at >> com.sun.xml.ws.transport.http.**client.HttpTransportPipe.** >> process(HttpTransportPipe.**java:179) >> at >> com.sun.xml.ws.transport.http.**client.HttpTransportPipe.** >> processRequest(**HttpTransportPipe.java:94) >> at >> com.sun.xml.ws.transport.**DeferredTransportPipe.**processRequest(** >> DeferredTransportPipe.java:**116) >> at com.sun.xml.ws.api.pipe.Fiber.**__doRun(Fiber.java:598) >> at com.sun.xml.ws.api.pipe.Fiber.**_doRun(Fiber.java:557) >> at com.sun.xml.ws.api.pipe.Fiber.**doRun(Fiber.java:542) >> at com.sun.xml.ws.api.pipe.Fiber.**runSync(Fiber.java:439) >> at com.sun.xml.ws.client.Stub.**process(Stub.java:222) >> at com.sun.xml.ws.client.sei.**SEIStub.doProcess(SEIStub.**java:135) >> at >> com.sun.xml.ws.client.sei.**SyncMethodHandler.invoke(** >> SyncMethodHandler.java:109) >> at >> com.sun.xml.ws.client.sei.**SyncMethodHandler.invoke(** >> SyncMethodHandler.java:89) >> at com.sun.xml.ws.client.sei.**SEIStub.invoke(SEIStub.java:**118) >> at $Proxy40.getRepositories(**Unknown Source) >> at >> org.apache.chemistry.opencmis.**client.bindings.spi.**webservices.** >> RepositoryServiceImpl.**getRepositoryInfos(Repository >> >> >> >> >> On Wed, Oct 31, 2012 at 12:40 PM, Florian M=FCller wro= te: >> >> Hi Srinivas, >>> >>> You need your own authentication provider for that. >>> >>> Have a look at this class: >>> org.apache.chemistry.opencmis.****client.bindings.spi.** >>> >>> StandardAuthenticationProvider >>> >>> The getSOAPHeaders() method generates the SOAP header. It should be eas= y >>> to add an additional tag there. >>> >>> You activate your custom authentication provider like this: >>> >>> parameter.put(****SessionParameter.****AUTHENTICATION_PROVIDER_CLASS, >>> "com.example.custom.****authentication.provider"); >>> >>> >>> You can also add your custom session parameters (-> AppID) and access >>> them >>> in the authentication provider. >>> >>> >>> - Florian >>> >>> >>> >>> Hello I am new to this forum, If I have posted to the wrong address, >>> >>>> please >>>> direct me to the correct forum, I am writing a client using apache >>>> chemistry and I am having hard time in sending a custom element in the >>>> username token >>>> >>>> myuser >>>> mypassword >>>> testappid >>>> >>>> >>>> >>>> How do I send in the AppID in the UsernameToken element, below only ha= s >>>> USER and PASSWORD. the AppID is of a different namespace >>>> >>>> parameter.put(****SessionParameter.USER, "myuser"); >>>> parameter.put(****SessionParameter.PASSWORD, "mypassword"); >>>> >>>> >>>> your input is greatly appreciated. >>>> thanks >>>> -- >>>> Srinivas >>>> >>>> >>> >> >> > --=20 Srinivas --e89a8f3bad4580cb6c04cdd51ab3--