Return-Path: X-Original-To: apmail-struts-user-archive@www.apache.org Delivered-To: apmail-struts-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id F0818109CA for ; Tue, 16 Jul 2013 09:00:16 +0000 (UTC) Received: (qmail 30085 invoked by uid 500); 16 Jul 2013 09:00:15 -0000 Delivered-To: apmail-struts-user-archive@struts.apache.org Received: (qmail 29985 invoked by uid 500); 16 Jul 2013 09:00:14 -0000 Mailing-List: contact user-help@struts.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Struts Users Mailing List" Reply-To: "Struts Users Mailing List" Delivered-To: mailing list user@struts.apache.org Received: (qmail 29976 invoked by uid 99); 16 Jul 2013 09:00:13 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 16 Jul 2013 09:00:13 +0000 X-ASF-Spam-Status: No, hits=2.2 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_NONE X-Spam-Check-By: apache.org Received-SPF: error (athena.apache.org: local policy) Received: from [209.85.192.169] (HELO mail-pd0-f169.google.com) (209.85.192.169) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 16 Jul 2013 09:00:08 +0000 Received: by mail-pd0-f169.google.com with SMTP id y10so461700pdj.28 for ; Tue, 16 Jul 2013 01:59:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:x-gm-message-state; bh=swZxxMFzr1TX81il4k39GviQvcB2ypV5710PkD4rqYA=; b=Dbv2QrcGhg7kfHjqiOP8FA3mR7zCtpr1KkZAH1IbQVaivZv1DlL8EfMU4OS2MGd55w W85fbZEmFRZLxcPlqh9/+8sK4LFMSVGMmqwQcaFcY7suI2V2JIxrfc7mknXTZWnPdaBf sh0iWrIJkeKa75LtNdEUSRyO5abIodcwtnd6Q0Gb7z9dn95ROvCpTl7XBBR3b7LM9SN1 8C0KnA+j+XaPJ6bJwM+otH3yvjm8en66DmyALDv8fnAUOwgTu5FWoJvIMrEDE9SQuHSL F397WJzXRpAL6y1uYltgJROVQkmu43OmlTE6D/zZmJj1SURtVFAd/7Ac8AwrU/w4a+yx KQqw== MIME-Version: 1.0 X-Received: by 10.66.248.164 with SMTP id yn4mr1575800pac.153.1373965168016; Tue, 16 Jul 2013 01:59:28 -0700 (PDT) Received: by 10.68.132.135 with HTTP; Tue, 16 Jul 2013 01:59:27 -0700 (PDT) In-Reply-To: <4507046.poIRgQDNPz@caridad> References: <1920484.F5dMfWpbVD@caridad> <2594641.4FbutaYlez@caridad> <4507046.poIRgQDNPz@caridad> Date: Tue, 16 Jul 2013 09:59:27 +0100 Message-ID: Subject: Re: S2 custom authentication: remembering original request From: Antonios Gkogkakis To: Struts Users Mailing List Content-Type: multipart/alternative; boundary=047d7b15b019c615a904e19d3190 X-Gm-Message-State: ALoCoQlqH86APFnK1Y4RhCq64q7mkBatq8KLztWKg1d4UVlA+QRANZPgbZQcfqYi6AZ1x4To2m2P X-Virus-Checked: Checked by ClamAV on apache.org --047d7b15b019c615a904e19d3190 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable You don't have to store text, you can store Object or even the File itself. it depend on where/when you extract the params from the original request Antonios On 16 July 2013 09:51, Antonio S=E1nchez wrote: > El Martes, 16 de julio de 2013 09:16:12 Antonios Gkogkakis escribi=F3: > > Hi Antonio, > > > > I don't see anything different with the multipart requests, are you > > experiencing issues? > > I'll try to test multipart requests and will let you know. I must first > review file uploading. The potential problem I see is that I am only savi= ng > in session text parameters. I don't know how binary data is transported i= n > the request. I headers are involved then they need to be saved too. > > > > > >>One more question: What should I do in case the original request is a > > multipart request? For instance: select picture -> click upload -> > > >>authentication -> upload action. > > > > > > On 15 July 2013 18:19, Antonio S=E1nchez wro= te: > > > > > Hi Antonios. Thank you very much. > > > > > > I was using > > > > > > invocation.getProxy().getConfig().getParams() > > > > > > instead, but that returns an immutable map. It works using > > > getInvocationContext().getParameters(). Thank you. > > > > > > I have to say that I'm not chaining actions: it doesn't make sense to > > > remember the original request if Login.jsp result breaks the chain > and, at > > > the end of the day, I have to code for remembering the original > parameters > > > (in the interceptor). I'm using redirectAction. > > > > > > One more question: What should I do in case the original request is a > > > multipart request? For instance: select picture -> click upload -> > > > authentication -> upload action. > > > > > > > > > El Lunes, 15 de julio de 2013 10:29:26 Antonios Gkogkakis escribi=F3: > > > > Hi Antonio, > > > > > > > > You can't modify the parameter map from the Servlet request, but yo= u > can > > > > pass the extra params from your first request to your action > > > > by putting them in the struts parameters map by calling invocation= . > > > > getInvocationContext().getParameters().#put. > > > > > > > > So to recap, you have your interceptor that catches the unauthorise= d > > > > action, you store the uri and all the params you need in the sessio= n, > > > > you redirect to the login page, and on login success you pass add t= he > > > extra > > > > params to the strut2 parameter map, and then struts will populate > your > > > > action. > > > > > > > > Antonios > > > > > > > > > > > > On 15 July 2013 10:16, Antonio S=E1nchez > wrote: > > > > > > > > > The problem was I did not consider the namespace in the > interceptor, > > > > > config file and login action. > > > > > > > > > > > > > > > > > > > > ${#session.action} > > > > > ${#session.space} > > > > > > > > > > > > > > > > > > > > Well, this is actually the easy part but the original question > remains: > > > > > How do I remember the original request parameters? > > > > > > > > > > When the flow is forwarded to Login.jsp the original request is > lost. I > > > > > can save the parameters map in session but when the time comes fo= r > the > > > > > originally requested action (dynamic result) I don't know how to > pass > > > the > > > > > original request parameters. I guess the right place to do it is > the > > > custom > > > > > interceptor but I don't know how to pass parameters to the > request. Is > > > it > > > > > possible to do? > > > > > > > > > > > > > > > El Viernes, 12 de julio de 2013 17:39:59 usted escribi=F3: > > > > > > If I use "redirections" I will lose the original > request(parameters, > > > > > uploading binary data ...). But I am unable to make it work using > > > forwards > > > > > (chaining actions). > > > > > > > > > > > > I give up. I can't do his with S2. I guess this use case requir= es > > > some > > > > > external approach: servlet filter (as Dave pointed out), containe= r > > > managed > > > > > security, Spring security... > > > > > > > > > > > > Thank you all for your support. > > > > > > > > > > > > El Viernes, 12 de julio de 2013 16:09:54 Rahul Tokase escribi= =F3: > > > > > > > Hi > > > > > > > Here is the way you can achieve this. > > > > > > > You need to design login action to have the url 'redirectto' > > > parameter > > > > > > > which will holds the redirectaction. Upon login interception > you > > > will > > > > > first > > > > > > > check the login is done and then check for this parameter if > there > > > any > > > > > > > value then simply forward to that action. else if login is > required > > > > > > > redirect it to the login page. > > > > > > > > > > > > > > If 'redirectto' url parameter is blank and login is success > then > > > > > forward it > > > > > > > to the home page. > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On Wed, Jul 10, 2013 at 5:57 PM, Antonio S=E1nchez > > > > > > > wrote: > > > > > > > > > > > > > > > Use Case: request some protected resource -> redirect actio= n > for > > > > > > > > authentication -> access protected resource. > > > > > > > > > > > > > > > > I'm using a custom interceptor that redirects > (redirectAction) > > > to a > > > > > global > > > > > > > > result if no user object is found in session. The final > action > > > > > result then > > > > > > > > redirects to a login page. > > > > > > > > > > > > > > > > The interceptor gets the original action requested (using > > > > > > > > request.getServletPath(), but not sure if this is right), a= nd > > > puts > > > > > it in > > > > > > > > the value stack. It would be used with dynamic redirection > in the > > > > > final > > > > > > > > result upon login success( ${nextAction} ) . This action > must be > > > > > passed in > > > > > > > > between redirections. > > > > > > > > > > > > > > > > But I need to reuse the original request. Reconstructing th= e > > > request > > > > > with > > > > > > > > a query string is not an option. I need the original reques= t: > > > > > GET/POST > > > > > > > > method, all parameters/values, maybe uploading binary conte= nt > > > > > > > > (inputstream), maybe headers... > > > > > > > > > > > > > > > > Is it possible to do this? How? > > > > > > > > > > > > > > > > ------ > > > > > > > > > > > > > > > > Partially related to this: I'm having problems with > > > redirections. The > > > > > > > > original request parameters are forwarded only using > dispatcher > > > > > result . If > > > > > > > > I use redirectAction or redirect, original params are lost. > Why? > > > > > > > > > > > > > > > > > > > --------------------------------------------------------------------- > > > > > > > > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org > > > > > > > > For additional commands, e-mail: user-help@struts.apache.or= g > > > > > > > > > > > > > > > > > > > > > > > > > > > --------------------------------------------------------------------- > > > > > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org > > > > > For additional commands, e-mail: user-help@struts.apache.org > > > > > > > > > > > > > > > > > > > > > --------------------------------------------------------------------- > > > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org > > > For additional commands, e-mail: user-help@struts.apache.org > > > > > > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org > For additional commands, e-mail: user-help@struts.apache.org > > > --047d7b15b019c615a904e19d3190--