V předkovi třídy AuthenticationProcessingFilter je deklarována metoda:
protected void onSuccessfulAuthentication(HttpServletRequest request,
HttpServletResponse response,
Authentication authResult) throws IOException {}
Ta má vše co potřebujete. Udělal bych tedy potomka
AuthenticationProcessingFilter, přepsal výše zmíněnou metodu a IP
adresu si uložil. Pokud byste si ji chtěl ukládat přímo do objektu
Authentication, který je přístupný přes security kontext, možná bych
zvažoval rozšíření metody:
/**
* Provided so that subclasses may configure what is put into the
authentication request's details
* property.
*
* @param request that an authentication request is being created for
* @param authRequest the authentication request object that
should have its details set
*/
protected void setDetails(HttpServletRequest request,
UsernamePasswordAuthenticationToken authRequest) {
authRequest.setDetails(authenticationDetailsSource.buildDetails(request));
}
Více určitě objevíte ve zdrojácích Acegi ;-)
Honza N.
23.1.08, Tomas Vojtech <[EMAIL PROTECTED]>:
> ahoj,
> v metode doFilter se vola metoda attemptAuthentication, kdyz neprojde
> autentizace tak by se mela vyhodit vyjimka, kdyz projde tak ta metoda
> vrati object Authentication, takze asi poupravit doFilter, berte to ale
> s rezervou, nemam to nijak podlozene, jenom sem se ted dival do kodu
> toho filtru
>
> Tomas
>
> radovan deka wrote:
> > Ahoj, rozhodl jsem se zkusit pouzit Acegi security na autentizaci
> > uzivatelu. Autentizace funguje ok, jen nevim jak vyresit pozadavek na
> > ulozeni IP adresy uzivatele a cas, pri kazde uspesne autentizaci.
> >
> > Vygooglil sem, ze je potreba rozsirit tridu AuthenticationProcessingFilter,
> > ale nevim, jak v teto tride poznam, jestli autentizace byla uspesna.
> >
> > Pak sem jeste narazil na moznost vytvorit listenera, ktery implementuje
> > ApplicationListener. V tomto pripde by nebyl problem ulozit ten cas, ale
> > zas nevim jak zjistit IP adresu.
> >
> > __________ Information from ESET Smart Security, version of virus signature
> > database 2815 (20080122) __________
> >
> > The message was checked by ESET Smart Security.
> >
> > http://www.eset.com
> >
> >
> >
> >
>
>
--
--------------------------------------------------------------
Ing. Jan Novotný
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
http://blog.novoj.net
Myšlenky dne otce Fura
--------------------------------------------------------------