Announcement Announcement Module
Collapse
No announcement yet.
Newbie Help getting started Page Title Module
Move Remove Collapse
This topic is closed
X
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Newbie Help getting started

    I am new to the Acegi System and would just like to see how it works by using the simplest of examples. I am currently running Tomcat 5.0 and cannot get it to work. I have copied the applicationContext.xml and web.xml from the quickstart directories. I have followed the installation instructions for Catalina (Tomcat) installation. I have also copied the acegilogin.jsp to my web root directory.

    When I type in the url for my web application it just takes me to me
    welcome page (index.jsp). What am I missing. I expected the acegilogin.jsp to appear.

    Thanks for patience with a newbie.

  • #2
    newbie

    One more thing.

    When I use the debug.jsp that comes with the sample application it says that my ContextHolder is null.

    Thanks

    Comment


    • #3
      Your /index.jsp probably isn't protected by Acegi Security. Take a look at your FilterSecurityInterceptor which will contain the URIs to be protected.

      If you need more help, please post your full application context and web.xml.

      Comment


      • #4
        Hi, Unfortunately I do need more help. Here are my config files.s

        Application Context
        [code]
        <?xml version="1.0" encoding="UTF-8"?>
        <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
        <beans>

        <!-- Data access object which stores authentication information -->
        <bean id="inMemoryDaoImpl" class="net.sf.acegisecurity.providers.dao.memory.I nMemoryDaoImpl">
        <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>

        <!-- Authentication provider that queries our data access object -->
        <bean id="daoAuthenticationProvider" class="net.sf.acegisecurity.providers.dao.DaoAuthe nticationProvider">
        <property name="authenticationDao"><ref bean="inMemoryDaoImpl"/></property>
        </bean>

        <!-- The authentication manager that iterates through our only authentication provider -->
        <bean id="authenticationManager" class="net.sf.acegisecurity.providers.ProviderMana ger">
        <property name="providers">
        <list>
        <ref bean="daoAuthenticationProvider"/>
        </list>
        </property>
        </bean>

        <bean id="authenticationProcessingFilter" class="net.sf.acegisecurity.ui.webapp.Authenticati onProcessingFilter">
        <property name="authenticationManager"><ref bean="authenticationManager"/></property>
        <property name="authenticationFailureUrl"><value>/failed.jsp</value></property>
        <property name="defaultTargetUrl"><value>/</value></property>
        <property name="filterProcessesUrl"><value>/j_acegi_security_check</value></property>
        </bean>

        <bean id="autoIntegrationFilter" class="net.sf.acegisecurity.ui.AutoIntegrationFilt er" />

        <bean id="filterInvocationInterceptor" class="net.sf.acegisecurity.intercept.web.FilterSe curityInterceptor">
        <property name="authenticationManager"><ref local="authenticationManager"/></property>
        <property name="accessDecisionManager"><ref local="accessDecisionManager"/></property>
        <property name="objectDefinitionSource">
        <value>
        CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON
        PATTERN_TYPE_APACHE_ANT
        /secure/**=ROLE_SUPERVISOR
        </value>
        </property>
        </bean>

        <bean id="authenticationProcessingFilterEntryPoint" class="net.sf.acegisecurity.ui.webapp.Authenticati onProcessingFilterEntryPoint">
        <property name="loginFormUrl"><value>/acegilogin.jsp</value></property>
        <property name="forceHttps"><value>false</value></property>
        </bean>


        <bean id="securityEnforcementFilter" class="net.sf.acegisecurity.intercept.web.Security EnforcementFilter">
        <property name="filterSecurityInterceptor"><ref local="filterInvocationInterceptor"/></property>
        <property name="authenticationEntryPoint"><ref local="authenticationProcessingFilterEntryPoint"/></property>
        </bean>

        <bean id="accessDecisionManager" class="net.sf.acegisecurity.vote.AffirmativeBased" >
        <property name="allowIfAllAbstainDecisions"><value>false</value></property>
        <property name="decisionVoters">
        <list>
        <ref local="roleVoter"/>
        </list>
        </property>
        </bean>

        <bean id="roleVoter" class="net.sf.acegisecurity.vote.RoleVoter"/>

        </beans>


        web.xml
        <?xml version="1.0" encoding="UTF-8"?>
        <!DOCTYPE web-app PUBLIC '-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN' 'http://java.sun.com/dtd/web-app_2_3.dtd'>

        <!--
        - These entries must be added to your EXISTING web.xml. This web.xml
        - cannot be used in its current form. It only contains fragments of a real
        - web.xml.
        -
        - $Id: web.xml,v 1.2 2004/08/03 07:18:32 benalex Exp $
        -->

        <web-app>

        <!-- It is assumed you are already using Spring's ContextLoaderListener -->

        <!-- Do not forget to remove any existing Servlet spec security directives from your current web.xml -->

        <!--
        - Location of the XML file that defines the root application context
        - Applied by ContextLoaderListener.
        -->
        <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>/WEB-INF/applicationContext.xml</param-value>
        </context-param>


        <filter>
        <filter-name>Acegi Authentication Processing Filter</filter-name>
        <filter-class>net.sf.acegisecurity.util.FilterToBeanProxy</filter-class>
        <init-param>
        <param-name>targetClass</param-name>
        <param-value>net.sf.acegisecurity.ui.webapp.Authenticatio nProcessingFilter</param-value>
        </init-param>
        </filter>

        <filter>
        <filter-name>Acegi Security System for Spring Auto Integration Filter</filter-name>
        <filter-class>net.sf.acegisecurity.util.FilterToBeanProxy</filter-class>
        <init-param>
        <param-name>targetClass</param-name>
        <param-value>net.sf.acegisecurity.ui.AutoIntegrationFilte r</param-value>
        </init-param>
        </filter>

        <filter>
        <filter-name>Acegi HTTP Request Security Filter</filter-name>
        <filter-class>net.sf.acegisecurity.util.FilterToBeanProxy</filter-class>
        <init-param>
        <param-name>targetClass</param-name>
        <param-value>net.sf.acegisecurity.intercept.web.SecurityE nforcementFilter</param-value>
        </init-param>
        </filter>

        <filter-mapping>
        <filter-name>Acegi Authentication Processing Filter</filter-name>
        <url-pattern>/*</url-pattern>
        </filter-mapping>

        <filter-mapping>
        <filter-name>Acegi Security System for Spring Auto Integration Filter</filter-name>
        <url-pattern>/*</url-pattern>
        </filter-mapping>

        <filter-mapping>
        <filter-name>Acegi HTTP Request Security Filter</filter-name>
        <url-pattern>/*</url-pattern>
        </filter-mapping>

        <listener>
        <listener-class>org.springframework.web.context.ContextLoade rListener</listener-class>
        </listener>
        </web-app>
        &#91;code&#93;
        &#91;/code&#93;

        Comment


        • #5
          As I said, /index.jsp isn't being protected. You can tell because the only actual URL listed against the FilterSecurityInterceptor is /secure/**=ROLE_SUPERVISOR.

          This means you'll need to hold ROLE_SUPERVISOR to call say /secure/somePage.jsp.

          The suggested pattern for Acegi Security applications is to have a /secure directory, and put everything somewhere under it. This leaves the root directory free to access, which is where you also drop your login page, logout page etc. We're going to implement some anonymous capabilities so even the root directory can be protected, but for now I'd KISS and put secure items under /secure.

          Comment


          • #6
            Newbie

            Thank you, I've got in now.

            Comment

            Working...
            X