Hi all,

First, sorry if this question is too basic and simple... but I really
already gave up on this. I have a servlet called TestServlet and is mapped
into /testservlet.do ... nothing special. Then I add security constraints
needed to protect it ...

    <security-constraint>
      <display-name>Secured Area Security Constraint</display-name>
      <web-resource-collection>
         <web-resource-name>Secured Area</web-resource-name>
         <url-pattern>/testservlet.do</url-pattern>
      </web-resource-collection>
      <auth-constraint>
         <role-name>ROLE_TELLER</role-name>
             <role-name>ROLE_SUPERVISOR</role-name>
      </auth-constraint>
    </security-constraint>

    <login-config>
      <auth-method>BASIC</auth-method>
      <realm-name>HelloWorld</realm-name>
    </login-config>

    <security-role>
      <role-name>ROLE_SUPERVISOR</role-name>
    </security-role>
    <security-role>
      <role-name>ROLE_TELLER</role-name>
    </security-role>

In web.xml, I also added
net.sf.acegisecurity.ui.basicauth.BasicProcessingFilter and
net.sf.acegisecurity.ui.AutoIntegrationFilter . Both of them are mapped into
/testservlet.do .

Then in applicationContext.xml, I added ....

    <!-- Start - Authentication-->
    <bean id="authenticationManager"
class="net.sf.acegisecurity.providers.ProviderManager">
        <property name="providers">
          <list>
            <ref bean="daoAuthenticationProvider"/>
          </list>
        </property>
    </bean>
    <bean id="inMemoryDaoImpl"
class="net.sf.acegisecurity.providers.dao.memory.InMemoryDaoImpl">
          <property name="userMap">
            <value>
                marissa=koala,ROLE_TELLER,ROLE_SUPERVISOR
                dianne=emu,ROLE_TELLER
                scott=wombat,ROLE_TELLER
                peter=opal,disabled,ROLE_TELLER
            </value>
        </property>
    </bean>
    <bean id="daoAuthenticationProvider"
class="net.sf.acegisecurity.providers.dao.DaoAuthenticationProvider">
         <property name="authenticationDao"><ref
bean="inMemoryDaoImpl"/></property>
    </bean>
    <bean id="basicProcessingFilter"
class="net.sf.acegisecurity.ui.basicauth.BasicProcessingFilter">
        <property name="authenticationManager"><ref
bean="authenticationManager"/></property>
        <property name="authenticationEntryPoint"><ref
bean="basicProcessingFilterEntryPoint"/></property>
    </bean>
    <bean id="basicProcessingFilterEntryPoint"
class="net.sf.acegisecurity.ui.basicauth.BasicProcessingFilterEntryPoint">
        <property name="realmName"><value>HelloWorld</value></property>
    </bean>
    <!-- End - Authentication -->

    <bean id="roleVoter" class="net.sf.acegisecurity.vote.RoleVoter"/>
    <bean id="httpRequestAccessDecisionManager"
class="net.sf.acegisecurity.vote.AffirmativeBased">
           <property
name="allowIfAllAbstainDecisions"><value>false</value></property>
        <property name="decisionVoters">
          <list>
            <ref bean="roleVoter"/>
          </list>
        </property>
    </bean>
    <bean id="filterInvocationInterceptor"
class="net.sf.acegisecurity.intercept.web.FilterSecurityInterceptor">
        <property name="authenticationManager"><ref
bean="authenticationManager"/></property>
        <property name="accessDecisionManager"><ref
bean="httpRequestAccessDecisionManager"/></property>
        <property name="objectDefinitionSource">
            <value>
                CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON
                \A/testservlet.do\Z=ROLE_SUPERVISOR
            </value>
        </property>
    </bean>

I deploy as acegifilter_demo.war into webapps directory of tomcat 5 without
any changes in tomcat's configuration files except that I uncomment its
memory realm....but I think it's not the problem.

I open up my Internet Explorer and entered
"http://localhost:8080/acegifilter_demo/testservlet.do";, a dialog asking for
username and password showed up as usual. I entered marissa as username and
koala as password. Then the application can't understand and keeps asking
username and password and after three times I got kicked out by error
401.....

Someone can point where my fault is? Thanks....

Indra


-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - 
digital self defense, top technical experts, no vendor pitches, 
unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
Acegisecurity-developer mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/acegisecurity-developer

Reply via email to