Return-Path: Delivered-To: apmail-cxf-dev-archive@www.apache.org Received: (qmail 74894 invoked from network); 7 Apr 2010 17:00:33 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 7 Apr 2010 17:00:33 -0000 Received: (qmail 46920 invoked by uid 500); 7 Apr 2010 17:00:33 -0000 Delivered-To: apmail-cxf-dev-archive@cxf.apache.org Received: (qmail 46846 invoked by uid 500); 7 Apr 2010 17:00:33 -0000 Mailing-List: contact dev-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list dev@cxf.apache.org Received: (qmail 46837 invoked by uid 99); 7 Apr 2010 17:00:33 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 07 Apr 2010 17:00:33 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of sberyozkin@gmail.com designates 209.85.220.212 as permitted sender) Received: from [209.85.220.212] (HELO mail-fx0-f212.google.com) (209.85.220.212) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 07 Apr 2010 17:00:26 +0000 Received: by fxm4 with SMTP id 4so1369532fxm.6 for ; Wed, 07 Apr 2010 10:00:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:received:message-id:subject:from:to:content-type; bh=omVGOS8DQ9tLC3eepnBPukJEdhufiSKPw4TNDb+pnjw=; b=DMz+xdrKSNnCKSGKE243jQXSs2MdMJojdz9q9gJKR+BM2XkunvUylO7qhqJ840tZN2 XQseLIx/eKhYULIVoDu0IjL1ZKdh6qFXA9F6q43LdT2bEzTQwz36h/PrslG9nHZtztAm ocgNDrGKBgF6uKnsWxi+PIACPheBvH22qucac= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=lCXwHdDuF6DuiUdluDw7wF4DKrBjjDziHoLSwcpXfTR3Yab57c+MDsweMzXyyRmAPQ XTVLZgJjlwnhcn3sgU5EWVhyb30+ATzhxThyVwYVy8sJvsxRLjJUuXd8XIZKsXla1iZX GKtx/AqS08E6A6IavkbEC7XeV/lZywrbyjuUw= MIME-Version: 1.0 Received: by 10.239.183.135 with HTTP; Wed, 7 Apr 2010 10:00:05 -0700 (PDT) In-Reply-To: References: <4BBC9E8F.8050105@redhat.com> <28167255.post@talk.nabble.com> Date: Wed, 7 Apr 2010 18:00:05 +0100 Received: by 10.239.166.195 with SMTP id c3mr858197hbe.57.1270659605675; Wed, 07 Apr 2010 10:00:05 -0700 (PDT) Message-ID: Subject: Re: Using WS-Security UsernameToken to authenticate users and populate SecurityContexts From: Sergey Beryozkin To: dev@cxf.apache.org Content-Type: multipart/alternative; boundary=001485f7beda6d40180483a87ef4 X-Virus-Checked: Checked by ClamAV on apache.org --001485f7beda6d40180483a87ef4 Content-Type: text/plain; charset=ISO-8859-1 Actually Glen, sorry for a speedy reply. Here are some more clarifications. Please have a look at the source of the AbstractWSS4JSecurityContextProviding interceptor. In a nutshell, it is a complex CallbackHandler which simply delegates the authentication to its subclass overriding createSubject method, by passing to it a user name, password(possibly digest), etc. The subclass will authenticate but also return a populated Subject which this CallbackHandler will store in the thread local storage to be later retrieved, at a moment when WSS4JInterceptor creates SecurityContext. Note that by default WSS4JInterceptor creates an incomplete SecurityContext which always returns 'false' in its isUserInRole. By letting subclasses to authenticate without implementing a CallbackHandler but also requiring them to populate a Subject we ensure that an authentication has been done but also make it possible to utilize a populated SecurityContext later on in the chain. Now, the above works for clear text passwords only at the moment (which might've been encrypted if passed over HTTP). To avoid a current WSS4J restriction with respect to digests, it also implements a simplified UsernameTokenProcessor but ultimately it also delegates to a subclass. Thanks for linking to that WSS4J jira. When CXF gets upgraded I can simplify the implementation dramatically by removing a Processor impl. hope it makes things clearer cheers, Sergey On Wed, Apr 7, 2010 at 5:22 PM, Sergey Beryozkin wrote: > Glen, > > > On Wed, Apr 7, 2010 at 5:12 PM, Glen Mazza wrote: > >> >> Sergey, be careful with your first reason--that of using the >> CallbackHandlers >> to *return* passwords, that's an old erroneous design apparently since >> fixed >> in WSS4J (https://issues.apache.org/jira/browse/WSS-183) that should not >> necessarily be used as a reason for doing what you're doing--that process >> should be taken out of CXF instead when it upgrades to the new WSS4J. >> > > I'm sorry but this does sounds convincing. You're kind of indicating that > what is proposed > is not good enough ? But you have not said anything about the > authorization. WSS4J is restricting with respects to digests at thje moment > but as I said, we're after the authorization here > > >> >> Actually, I think Metro does what you want--allows the option for >> container-managed authentication *without* the callbackhandler >> (http://www.jroller.com/gmazza/entry/metro_usernametoken_profile#MetroUT3 >> ). >> If you can repeat the same with CXF, great! >> > > I really don't follow why you refer to Metro, what is to do with the use of > CXF ? > > Sergey > > >> >> Glen >> >> >> Sergey Beryozkin-5 wrote: >> > >> > There are few problems with depending on CallbackHandlers only : >> > >> > - when passwords have been digested, WSS4JInterceptor requires a clear >> > text >> > password back to verify a digest which is not realistic in cases where >> an >> > external system can authenticate a user with the digest password but >> have >> > no >> > way of returning an actual password for this CallbackHandler to give it >> to >> > WSS4JInterceptor >> > - authentication is only part of the story, what is really important is >> > that >> > the authorization can be done further down the line. I don't think >> trying >> > to >> > do the authorization from the CallbackHandler is a good approach - we >> > don't >> > even know the method name to be invoked upon >> > >> > Now, perhaps one can even authenticate and authorize from a callback >> > handler >> > by somehow getting to the current Message, figuring out the method name, >> > etc. But IMHO the proposed approach is cleaner and it gives more options >> > as >> > to when an authorization should be done due to the fact we have a valid >> > SecurityContext in scope >> > >> >> -- >> View this message in context: >> http://old.nabble.com/Using-WS-Security-UsernameToken-to-authenticate-users-and-populate--SecurityContexts-tp28165583p28167255.html >> Sent from the cxf-dev mailing list archive at Nabble.com. >> >> > --001485f7beda6d40180483a87ef4--