Results 1 to 8 of 8

Thread: how to process single login in Acegi?

  1. #1
    Join Date
    Jan 2005
    Posts
    10

    Default how to process single login in Acegi?

    when a user is logined, i want to prevent other user login my system using same user id and same password. how to process single user login in this condiction.thanks

  2. #2
    Join Date
    Oct 2004
    Location
    Austin, TX, USA
    Posts
    60

    Default

    I haven't actually used it yet, but 0.8.0 contains a ConcurrentSessionController that can be used for this purpose:

    http://acegisecurity.sourceforge.net...ontroller.html

    FYI, the upgrade notes (http://acegisecurity.sourceforge.net...e-070-080.html) say:

    If you wish to use the new ConcurrentSessionController you must declare the HttpSessionEventPublisher context listener in your web.xml

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

    Default

    ConcurrentSessionController is designed for ths exact purpose.

  4. #4
    Join Date
    Mar 2005
    Location
    Atlanta, GA, USA
    Posts
    19

    Default ConcurrentSessionControllerImpl Configuration Example?

    Could someone please provide an example of how to configure the new ConcurrentSessionController feature?

    I checked the reference doc & the 0.80 version of the contacts application, but it doesn't appear to have made it into there yet.

    From reading the javadoc, it appears that you would need something like this:

    Code:
       <bean id="authenticationManager" class="net.sf.acegisecurity.providers.ProviderManager">
          <property name="providers">
             <list>
                <ref local="daoAuthenticationProvider"/>
                <ref local="anonymousAuthenticationProvider"/>
                <ref local="rememberMeAuthenticationProvider"/>
             </list>
          </property>
          <property name="sessionController">
              <bean class="net.sf.acegisecurity.providers.ConcurrentSessionControllerImpl"/>
          </property>
          <property name="trustResolver">
              <bean class="net.sf.acegisecurity.AuthenticationTrustResolverImpl"/>
          </property>
       </bean>
    Along with this in web.xml:
    Code:
     <listener>
        <listener-class>net.sf.acegisecurity.ui.session.HttpSessionEventPublisher</listener-class>
    </listener>
    Is there anything I'm missing?

    Thanks,
    David

  5. #5
    Join Date
    Mar 2005
    Location
    Atlanta, GA, USA
    Posts
    19

    Default ConcurrentSessionControllerImpl Configuration Example?

    I think my property nesting was incorrect in my previous post.

    trustResolver is a property of sessionController, not of authenticationManager:

    Code:
       <bean id="authenticationManager" class="net.sf.acegisecurity.providers.ProviderManager">
          <property name="providers">
             <list>
                <ref local="daoAuthenticationProvider"/>
                <ref local="anonymousAuthenticationProvider"/>
                <ref local="rememberMeAuthenticationProvider"/>
             </list>
          </property>
          <property name="sessionController">
              <bean class="net.sf.acegisecurity.providers.ConcurrentSessionControllerImpl">
    	          <property name="trustResolver">
    		        <bean class="net.sf.acegisecurity.AuthenticationTrustResolverImpl"/>
    	          </property>
               </bean>
          </property>
       </bean>
    David Carter

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

    Default

    David, you shouldn't need to set ConcurrentSessionControllerImpl.trustResolver as it already defaults to AuthenticationTrustResolverImpl.

    Is it now working for you overall?

  7. #7
    Join Date
    Mar 2005
    Posts
    5

    Default

    I declare the HttpSessionEventPublisher context listener in my web.xml, and also add the following code in my application, but it's not work yet.
    Is there anything I'm missing?

    Code:
    <bean id="authenticationManager" class="net.sf.acegisecurity.providers.ProviderManager">
    		<property name="providers">
    		  <list>
    		    <ref bean="daoAuthenticationProvider"/>
    		  </list>
    		</property>
    		<property name="sessionController"> 
              <bean class="net.sf.acegisecurity.providers.ConcurrentSessionControllerImpl"> </bean> 
            </property> 
    	</bean>
    And if I don't want to declare the HttpSessionEventPublisher context listener in my web.xml, where can I declare it?(I have configured the contextConfigLocation in other xml file)

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

    Default

    As per the reference guide, ConcurrentSessionControllerImpl must be a separate bean definition to receive ApplicationEvents. See the reference guide section on concurrent sessions to see correct configuration.

Similar Threads

  1. Replies: 4
    Last Post: Aug 21st, 2006, 01:09 AM
  2. acegi + CAS going in loop after login
    By mcecca in forum Security
    Replies: 3
    Last Post: Sep 30th, 2005, 02:56 PM
  3. Replies: 1
    Last Post: Feb 24th, 2005, 03:04 PM
  4. Acegi - Login Tapestry another clarification
    By john017 in forum Security
    Replies: 1
    Last Post: Feb 4th, 2005, 01:36 AM
  5. Acegi - Login Tapestry
    By john017 in forum Security
    Replies: 1
    Last Post: Feb 4th, 2005, 01:11 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
  •