Results 1 to 6 of 6

Thread: Newbie Help getting started

  1. #1
    Join Date
    Dec 2004
    Posts
    11

    Default 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. #2
    Join Date
    Dec 2004
    Posts
    11

    Default newbie

    One more thing.

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

    Thanks

  3. #3
    Join Date
    Aug 2004
    Location
    Sydney, Australia
    Posts
    2,768

    Default

    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.

  4. #4
    Join Date
    Dec 2004
    Posts
    11

    Default

    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;

  5. #5
    Join Date
    Aug 2004
    Location
    Sydney, Australia
    Posts
    2,768

    Default

    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.

  6. #6
    Join Date
    Dec 2004
    Posts
    11

    Default Newbie

    Thank you, I've got in now.

Similar Threads

  1. Getting started with Spring + Maven
    By ejeklint in forum Architecture
    Replies: 3
    Last Post: Dec 27th, 2006, 10:25 AM
  2. Getting Started...Pointers needed
    By anagha in forum AOP
    Replies: 5
    Last Post: Sep 13th, 2005, 01:03 AM
  3. Replies: 5
    Last Post: Sep 3rd, 2005, 10:02 AM
  4. Replies: 1
    Last Post: Jun 12th, 2005, 08:46 AM
  5. (newbie) replacing osuser?
    By greg_greg in forum Security
    Replies: 2
    Last Post: Nov 6th, 2004, 08:23 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •