spring acegi injection question

2007-10-20 Thread auron

Hi everyone, 

On this page: 

http://cwiki.apache.org/WICKET/acegi-and-wicket-auth-roles.html

there is a section that w/ the following code: 

public class WicketApplication extends AuthenticatedWebApplication {
//to be injected by Spting
private AuthenticationManager authenticationManager;

[...]

I am new to both wicket, spring, and acegi, so please forgive me if the
answer is obvious, but how do I inject authenticationManager into
WicketApplication? I have a setAuthenticationManager method and in my
applicationContext.xml I have the following:












Any help is greatly appreciated, thank you!

Jin
-- 
View this message in context: 
http://www.nabble.com/spring-acegi-injection-question-tf4658329.html#a13310889
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: spring acegi injection question

2007-10-20 Thread Igor Vaynberg
thats exactly how you do it, the piece you are missing is that you
need to tell wicket to pull your application object out of spring
context rather then create a new instance. see
SpringWebApplicationFactory and its javadoc.

-igor


On 10/20/07, auron <[EMAIL PROTECTED]> wrote:
>
> Hi everyone,
>
> On this page:
>
> http://cwiki.apache.org/WICKET/acegi-and-wicket-auth-roles.html
>
> there is a section that w/ the following code:
>
> public class WicketApplication extends AuthenticatedWebApplication {
> //to be injected by Spting
> private AuthenticationManager authenticationManager;
>
> [...]
>
> I am new to both wicket, spring, and acegi, so please forgive me if the
> answer is obvious, but how do I inject authenticationManager into
> WicketApplication? I have a setAuthenticationManager method and in my
> applicationContext.xml I have the following:
>
> 
> 
> 
>  class="org.springframework.security.providers.ProviderManager">
> 
> 
> 
> 
> 
> 
>
> Any help is greatly appreciated, thank you!
>
> Jin
> --
> View this message in context: 
> http://www.nabble.com/spring-acegi-injection-question-tf4658329.html#a13310889
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: spring acegi injection question

2007-10-20 Thread auron

Hi Igor - 

Thanks alot for your help, I really appreciate it - 

I knew I was missing something, thanks for pointing me towards the right
direction. I editied my web.xml as necessary but for some reason,
authenticationManager is still not getting injected. Would you mind looking
through my web.xml to make sure things are in order? 

Once again, thank you very much for your time - 

Jin


http://java.sun.com/xml/ns/j2ee";
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
 xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd";
 version="2.4">

edu_ucsd_acp


wicket

org.apache.wicket.protocol.http.WicketServlet

applicationFactoryClassName

org.apache.wicket.spring.SpringWebApplicationFactory

1

 

Acegi HTTP Request Security Filter

org.springframework.security.util.FilterToBeanProxy

targetClass

org.springframework.security.util.FilterChainProxy




contextConfigLocation
/WEB-INF/applicationContext*.xml



Acegi HTTP Request Security Filter
/*

   
wicket.edu_ucsd_acp

org.apache.wicket.protocol.http.WicketFilter

applicationClassName

edu.ucsd.acp.web.WicketApplication




wicket.edu_ucsd_acp
/*





org.springframework.web.context.ContextLoaderListener




igor.vaynberg wrote:
> 
> thats exactly how you do it, the piece you are missing is that you
> need to tell wicket to pull your application object out of spring
> context rather then create a new instance. see
> SpringWebApplicationFactory and its javadoc.
> 
> -igor
> 
> 
> On 10/20/07, auron <[EMAIL PROTECTED]> wrote:
>>
>> Hi everyone,
>>
>> On this page:
>>
>> http://cwiki.apache.org/WICKET/acegi-and-wicket-auth-roles.html
>>
>> there is a section that w/ the following code:
>>
>> public class WicketApplication extends AuthenticatedWebApplication {
>> //to be injected by Spting
>> private AuthenticationManager authenticationManager;
>>
>> [...]
>>
>> I am new to both wicket, spring, and acegi, so please forgive me if the
>> answer is obvious, but how do I inject authenticationManager into
>> WicketApplication? I have a setAuthenticationManager method and in my
>> applicationContext.xml I have the following:
>>
>> 
>> > ref="authenticationManager"/>
>> 
>> > class="org.springframework.security.providers.ProviderManager">
>> 
>> 
>> 
>> 
>> 
>> 
>>
>> Any help is greatly appreciated, thank you!
>>
>> Jin
>> --
>> View this message in context:
>> http://www.nabble.com/spring-acegi-injection-question-tf4658329.html#a13310889
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>> -----
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/spring-acegi-injection-question-tf4658329.html#a13322945
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: spring acegi injection question

2007-10-20 Thread Igor Vaynberg
you changed it for the servlet but not for the filter? why do you have
both defined?

-igor


On 10/20/07, auron <[EMAIL PROTECTED]> wrote:
>
> Hi Igor -
>
> Thanks alot for your help, I really appreciate it -
>
> I knew I was missing something, thanks for pointing me towards the right
> direction. I editied my web.xml as necessary but for some reason,
> authenticationManager is still not getting injected. Would you mind looking
> through my web.xml to make sure things are in order?
>
> Once again, thank you very much for your time -
>
> Jin
>
> 
> http://java.sun.com/xml/ns/j2ee";
>  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>  xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
> http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd";
>  version="2.4">
>
> edu_ucsd_acp
> 
> 
> wicket
>
> org.apache.wicket.protocol.http.WicketServlet
> 
> applicationFactoryClassName
>
> org.apache.wicket.spring.SpringWebApplicationFactory
> 
> 1
> 
>  
> 
> Acegi HTTP Request Security Filter
>
> org.springframework.security.util.FilterToBeanProxy
> 
> targetClass
>
> org.springframework.security.util.FilterChainProxy
> 
> 
>
> 
> contextConfigLocation
> /WEB-INF/applicationContext*.xml
> 
>
> 
> Acegi HTTP Request Security Filter
> /*
> 
>
> wicket.edu_ucsd_acp
> 
> org.apache.wicket.protocol.http.WicketFilter
> 
> applicationClassName
> 
> edu.ucsd.acp.web.WicketApplication
> 
> 
>
> 
> wicket.edu_ucsd_acp
> /*
> 
>
> 
> 
>
> org.springframework.web.context.ContextLoaderListener
> 
> 
>
>
> igor.vaynberg wrote:
> >
> > thats exactly how you do it, the piece you are missing is that you
> > need to tell wicket to pull your application object out of spring
> > context rather then create a new instance. see
> > SpringWebApplicationFactory and its javadoc.
> >
> > -igor
> >
> >
> > On 10/20/07, auron <[EMAIL PROTECTED]> wrote:
> >>
> >> Hi everyone,
> >>
> >> On this page:
> >>
> >> http://cwiki.apache.org/WICKET/acegi-and-wicket-auth-roles.html
> >>
> >> there is a section that w/ the following code:
> >>
> >> public class WicketApplication extends AuthenticatedWebApplication {
> >> //to be injected by Spting
> >> private AuthenticationManager authenticationManager;
> >>
> >> [...]
> >>
> >> I am new to both wicket, spring, and acegi, so please forgive me if the
> >> answer is obvious, but how do I inject authenticationManager into
> >> WicketApplication? I have a setAuthenticationManager method and in my
> >> applicationContext.xml I have the following:
> >>
> >> 
> >>  >> ref="authenticationManager"/>
> >> 
> >>  >> class="org.springframework.security.providers.ProviderManager">
> >> 
> >> 
> >> 
> >> 
> >> 
> >> 
> >>
> >> Any help is greatly appreciated, thank you!
> >>
> >> Jin
> >> --
> >> View this message in context:
> >> http://www.nabble.com/spring-acegi-injection-question-tf4658329.html#a13310889
> >> Sent from the Wicket - User mailing list archive at Nabble.com.
> >>
> >>
> >> -
> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >> For additional commands, e-mail: [EMAIL PROTECTED]
> >>
> >>
> >
> > -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> >
>
> --
> View this message in context: 
> http://www.nabble.com/spring-acegi-injection-question-tf4658329.html#a13322945
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: spring acegi injection question

2007-10-20 Thread auron

Hi Igor - 

Well, the filter was included with the wicket quickstart maven package, and
the servlet I copied from the wicket wiki. What should I change in the
filter?

And, is it 'wrong' to have both servlet and filter defined? 

Thanks again,
Jin


igor.vaynberg wrote:
> 
> you changed it for the servlet but not for the filter? why do you have
> both defined?
> 
> -igor
> 
> 
> On 10/20/07, auron <[EMAIL PROTECTED]> wrote:
>>
>> Hi Igor -
>>
>> Thanks alot for your help, I really appreciate it -
>>
>> I knew I was missing something, thanks for pointing me towards the right
>> direction. I editied my web.xml as necessary but for some reason,
>> authenticationManager is still not getting injected. Would you mind
>> looking
>> through my web.xml to make sure things are in order?
>>
>> Once again, thank you very much for your time -
>>
>> Jin
>>
>> 
>> http://java.sun.com/xml/ns/j2ee";
>>  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>>  xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
>> http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd";
>>  version="2.4">
>>
>> edu_ucsd_acp
>> 
>> 
>> wicket
>>
>> org.apache.wicket.protocol.http.WicketServlet
>> 
>>
>> applicationFactoryClassName
>>
>> org.apache.wicket.spring.SpringWebApplicationFactory
>> 
>> 1
>> 
>>  
>> 
>> Acegi HTTP Request Security
>> Filter
>>
>> org.springframework.security.util.FilterToBeanProxy
>> 
>> targetClass
>>
>> org.springframework.security.util.FilterChainProxy
>> 
>> 
>>
>> 
>> contextConfigLocation
>> /WEB-INF/applicationContext*.xml
>> 
>>
>> 
>> Acegi HTTP Request Security Filter
>> /*
>> 
>>
>> wicket.edu_ucsd_acp
>>
>> org.apache.wicket.protocol.http.WicketFilter
>> 
>> applicationClassName
>>
>> edu.ucsd.acp.web.WicketApplication
>> 
>> 
>>
>> 
>> wicket.edu_ucsd_acp
>> /*
>> 
>>
>> 
>> 
>>
>> org.springframework.web.context.ContextLoaderListener
>> 
>> 
>>
>>
>> igor.vaynberg wrote:
>> >
>> > thats exactly how you do it, the piece you are missing is that you
>> > need to tell wicket to pull your application object out of spring
>> > context rather then create a new instance. see
>> > SpringWebApplicationFactory and its javadoc.
>> >
>> > -igor
>> >
>> >
>> > On 10/20/07, auron <[EMAIL PROTECTED]> wrote:
>> >>
>> >> Hi everyone,
>> >>
>> >> On this page:
>> >>
>> >> http://cwiki.apache.org/WICKET/acegi-and-wicket-auth-roles.html
>> >>
>> >> there is a section that w/ the following code:
>> >>
>> >> public class WicketApplication extends AuthenticatedWebApplication {
>> >> //to be injected by Spting
>> >> private AuthenticationManager authenticationManager;
>> >>
>> >> [...]
>> >>
>> >> I am new to both wicket, spring, and acegi, so please forgive me if
>> the
>> >> answer is obvious, but how do I inject authenticationManager into
>> >> WicketApplication? I have a setAuthenticationManager method and in my
>> >> applicationContext.xml I have the following:
>> >>
>> >> 
>> >> > >> ref="authenticationManager"/>
>> >> 
>> >> > >> class="org.springframework.security.providers.ProviderManager">
>> >> 
>> >> 
>> >> 
>> >> 
>> >> 
>> >> 
>> >>
>> >> Any help is greatly appreciated, thank you!
>> >>
>> >> Jin
>> >> --
>> >> View this message in context:
>> >>
>> http://www.nabble.com/spring-acegi-injection-question-tf4658329.

Re: spring acegi injection question

2007-10-20 Thread Igor Vaynberg
in 1.2 wicket was configured through a servlet. in 1.3 we decided it
was much better to use a filter because you can map to /* easier. so
your web.xml should have only one of those.

obviously quickstart is a fully configured project, why did you think
you had to add an extra wicket servlet into it?

change filter's init params just like you changed the servlet, to use
springwebapp factory.

-igor


On 10/20/07, auron <[EMAIL PROTECTED]> wrote:
>
> Hi Igor -
>
> Well, the filter was included with the wicket quickstart maven package, and
> the servlet I copied from the wicket wiki. What should I change in the
> filter?
>
> And, is it 'wrong' to have both servlet and filter defined?
>
> Thanks again,
> Jin
>
>
> igor.vaynberg wrote:
> >
> > you changed it for the servlet but not for the filter? why do you have
> > both defined?
> >
> > -igor
> >
> >
> > On 10/20/07, auron <[EMAIL PROTECTED]> wrote:
> >>
> >> Hi Igor -
> >>
> >> Thanks alot for your help, I really appreciate it -
> >>
> >> I knew I was missing something, thanks for pointing me towards the right
> >> direction. I editied my web.xml as necessary but for some reason,
> >> authenticationManager is still not getting injected. Would you mind
> >> looking
> >> through my web.xml to make sure things are in order?
> >>
> >> Once again, thank you very much for your time -
> >>
> >> Jin
> >>
> >> 
> >> http://java.sun.com/xml/ns/j2ee";
> >>  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> >>  xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
> >> http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd";
> >>  version="2.4">
> >>
> >> edu_ucsd_acp
> >> 
> >> 
> >> wicket
> >>
> >> org.apache.wicket.protocol.http.WicketServlet
> >> 
> >>
> >> applicationFactoryClassName
> >>
> >> org.apache.wicket.spring.SpringWebApplicationFactory
> >> 
> >> 1
> >> 
> >>  
> >> 
> >> Acegi HTTP Request Security
> >> Filter
> >>
> >> org.springframework.security.util.FilterToBeanProxy
> >> 
> >> targetClass
> >>
> >> org.springframework.security.util.FilterChainProxy
> >> 
> >> 
> >>
> >> 
> >> contextConfigLocation
> >> /WEB-INF/applicationContext*.xml
> >> 
> >>
> >> 
> >> Acegi HTTP Request Security Filter
> >> /*
> >> 
> >>
> >> wicket.edu_ucsd_acp
> >>
> >> org.apache.wicket.protocol.http.WicketFilter
> >> 
> >> applicationClassName
> >>
> >> edu.ucsd.acp.web.WicketApplication
> >> 
> >> 
> >>
> >> 
> >> wicket.edu_ucsd_acp
> >> /*
> >> 
> >>
> >> 
> >> 
> >>
> >> org.springframework.web.context.ContextLoaderListener
> >> 
> >> 
> >>
> >>
> >> igor.vaynberg wrote:
> >> >
> >> > thats exactly how you do it, the piece you are missing is that you
> >> > need to tell wicket to pull your application object out of spring
> >> > context rather then create a new instance. see
> >> > SpringWebApplicationFactory and its javadoc.
> >> >
> >> > -igor
> >> >
> >> >
> >> > On 10/20/07, auron <[EMAIL PROTECTED]> wrote:
> >> >>
> >> >> Hi everyone,
> >> >>
> >> >> On this page:
> >> >>
> >> >> http://cwiki.apache.org/WICKET/acegi-and-wicket-auth-roles.html
> >> >>
> >> >> there is a section that w/ the following code:
> >> >>
> >> >> public class WicketApplication extends AuthenticatedWebApplication {
> >> >> //to be injected by Spting
> >> >> private AuthenticationManager authenticationManager;
> >> >>
> >> >> [...]
> >> >>
> >>

Re: spring acegi injection question

2007-10-22 Thread Michael Sparer

Hi auron, 

by chance I did the same on friday and it works for me. The only differences
to my xml-files I noticed was, as Igor said, the use of the wicket filter
instead of the wicket servlet. I.e.



your.app.name

org.apache.wicket.protocol.http.WicketFilter

applicationFactoryClassName

org.apache.wicket.spring.SpringWebApplicationFactory

1


AND it is important to add a setter for the authentication manager (which is
not shown in the wiki), i.e.

public void setAuthenticationManager(AuthenticationManager
authenticationManager) {
_authenticationManager = authenticationManager;
}

otherwise spring wouldn't be able to inject the bean - this is different to
the annotation-based approach where a setter is not required. but AFAIK it
is not possible to inject a spring-bean into the application class using the
annotation based approach.

greetings

Michael
-- 
View this message in context: 
http://www.nabble.com/spring-acegi-injection-question-tf4658329.html#a13338057
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: spring acegi injection question

2007-10-22 Thread auron

Hi Mike and Igor - 

Thanks a bunch for the tips. I didn't realize the mistake I was making due
to my lack of knowledge with servlets/filters/web.xml. I see what's going on
now. 

Happy to report that I have it up and working, its very cool. Thanks again
for your help, really really appreciated. 

Jin


auron wrote:
> 
> Hi Igor - 
> 
> Well, the filter was included with the wicket quickstart maven package,
> and the servlet I copied from the wicket wiki. What should I change in the
> filter?
> 
> And, is it 'wrong' to have both servlet and filter defined? 
> 
> Thanks again,
> Jin
> 
> 
> igor.vaynberg wrote:
>> 
>> you changed it for the servlet but not for the filter? why do you have
>> both defined?
>> 
>> -igor
>> 
>> 
>> On 10/20/07, auron <[EMAIL PROTECTED]> wrote:
>>>
>>> Hi Igor -
>>>
>>> Thanks alot for your help, I really appreciate it -
>>>
>>> I knew I was missing something, thanks for pointing me towards the right
>>> direction. I editied my web.xml as necessary but for some reason,
>>> authenticationManager is still not getting injected. Would you mind
>>> looking
>>> through my web.xml to make sure things are in order?
>>>
>>> Once again, thank you very much for your time -
>>>
>>> Jin
>>>
>>> 
>>> http://java.sun.com/xml/ns/j2ee";
>>>  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>>>  xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
>>> http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd";
>>>  version="2.4">
>>>
>>> edu_ucsd_acp
>>> 
>>> 
>>> wicket
>>>
>>> org.apache.wicket.protocol.http.WicketServlet
>>> 
>>>
>>> applicationFactoryClassName
>>>
>>> org.apache.wicket.spring.SpringWebApplicationFactory
>>> 
>>> 1
>>> 
>>>  
>>> 
>>> Acegi HTTP Request Security
>>> Filter
>>>
>>> org.springframework.security.util.FilterToBeanProxy
>>> 
>>> targetClass
>>>
>>> org.springframework.security.util.FilterChainProxy
>>> 
>>> 
>>>
>>> 
>>> contextConfigLocation
>>> /WEB-INF/applicationContext*.xml
>>> 
>>>
>>> 
>>> Acegi HTTP Request Security Filter
>>> /*
>>> 
>>>
>>> wicket.edu_ucsd_acp
>>>
>>> org.apache.wicket.protocol.http.WicketFilter
>>> 
>>> applicationClassName
>>>
>>> edu.ucsd.acp.web.WicketApplication
>>> 
>>> 
>>>
>>> 
>>> wicket.edu_ucsd_acp
>>> /*
>>> 
>>>
>>> 
>>> 
>>>
>>> org.springframework.web.context.ContextLoaderListener
>>> 
>>> 
>>>
>>>
>>> igor.vaynberg wrote:
>>> >
>>> > thats exactly how you do it, the piece you are missing is that you
>>> > need to tell wicket to pull your application object out of spring
>>> > context rather then create a new instance. see
>>> > SpringWebApplicationFactory and its javadoc.
>>> >
>>> > -igor
>>> >
>>> >
>>> > On 10/20/07, auron <[EMAIL PROTECTED]> wrote:
>>> >>
>>> >> Hi everyone,
>>> >>
>>> >> On this page:
>>> >>
>>> >> http://cwiki.apache.org/WICKET/acegi-and-wicket-auth-roles.html
>>> >>
>>> >> there is a section that w/ the following code:
>>> >>
>>> >> public class WicketApplication extends AuthenticatedWebApplication {
>>> >> //to be injected by Spting
>>> >> private AuthenticationManager authenticationManager;
>>> >>
>>> >> [...]
>>> >>
>>> >> I am new to both wicket, spring, and acegi, so please forgive me if
>>> the
>>> >> answer is obvious, but how do I inject authenticationManage

Re: spring acegi injection question

2007-10-22 Thread Evan Chooly
You can do this:

InjectorHolder.getInjector().inject(this);

You need to do it in init(), though.  The constructor is too early for the
injector to be configured.  Other than that, you can @SpringBean any bean
you want.

otherwise spring wouldn't be able to inject the bean - this is different to
> the annotation-based approach where a setter is not required. but AFAIK it
> is not possible to inject a spring-bean into the application class using
> the
> annotation based approach.
>
> greetings
>
> Michael
> --
> View this message in context:
> http://www.nabble.com/spring-acegi-injection-question-tf4658329.html#a13338057
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>