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

  • Consulitng concepts

    Hi guys

    after see the code source tutorial

    is a good practice have the user and theirs password, defined in the somefile.xml
    like

    Code:
       <!-- Simplest mapping between user, password and roles -->
    
    	<bean id="inMemoryDaoImpl" class="org.acegisecurity.userdetails.memory.InMemoryDaoImpl">
    
          <property name="userMap">
    
            <value>
    
                marissa=koala,ROLE_USER
    
                dianne=emu,ROLE_SUPERVISOR
    
                scott=wombat,ROLE_USER,ROLE_SUPERVISOR
    
            </value>
    
         </property>
    
       </bean>
    or users.properties

    these ways is only shown for tutorial example??? or this really the best way to do this,

    can some member of the forum share best practices about this?? (maybe have the information user/password in db)

    thanks for advanced

  • #2
    It very much depends on your requirements. You could leave them in the XML, put it in a properties file, use a database, etc........ You can always write your own if you want to do something completely different. Typically I've used a database.
    http://acegisecurity.org/multiprojec...ryDaoImpl.html
    http://acegisecurity.org/multiprojec...bcDaoImpl.html

    Comment


    • #3
      Hi karldmoore

      thanks for the reply

      Typically I've used a database.
      how?
      that means,
      how integrate with the xml? ,
      (the xml call or load a .properties or use the information already written in the xml file )
      AOP enter here????

      sorry if this is asilly question, but examples of this, well ,
      there is not a good amount

      by the moment i can use the simple version (.properties)

      thanks for advanced

      Comment


      • #4
        That's what the link was for . JdbcDaoImpl is a UserDetailsService implementation tha works with databases. It has default SQL queries for finding users and role assignments. You can inject your own queries in if you want. All you need to do here is replace the current "inMemoryDaoImpl" bean with the JdbcDaoImpl one.
        http://acegisecurity.org/multiprojec...bcDaoImpl.html

        Comment


        • #5
          hi karldmoore ,
          well you can conclude that i am lost in thi case , the examples is not enough

          regards

          Comment


          • #6
            This bean would replace the current in memory one.
            Code:
            <bean id="inMemoryDaoImpl" class="org.acegisecurity.userdetails.jdbc.JdbcDaoImpl
            ">
            	<property name="dataSource"><ref bean="dataSource"/></property>
            </bean>
            These are the default queries that would be run for you.
            Code:
            public static final String DEF_USERS_BY_USERNAME_QUERY = "SELECT username,password,enabled FROM users WHERE username = ?";
            public static final String DEF_AUTHORITIES_BY_USERNAME_QUERY = "SELECT username,authority FROM authorities WHERE username = ?";
            If you want to override the default queries then you can inject your own.
            Code:
            <bean id="inMemoryDaoImpl" class="org.acegisecurity.userdetails.jdbc.JdbcDaoImpl
            ">
            	<property name="dataSource"><ref bean="dataSource"/></property>
            	<property name="usersByUsernameQuery">
            		<value>SELECT UD_USERNAME,UD_PASSWORD,ENABLED as 'true',UD_EMAIL_ID FROM LOGIN WHERE UD_USERNAME = ?</value>
            	</property>
            	<property name="authoritiesByUsernameQuery">
            		<value>SELECT L.UD_USERNAME,R.RM_DESC FROM LOGIN L, ROLE_MASTER R  WHERE UD_USERNAME=? </value>
            	</property>
            </bean>

            Comment


            • #7
              thanks so much karldmoore for the help

              by the moment i will use the xml or properties way , and after i should learn your way explained (and i think that is the classic and best way)

              i must integrate acegi with spring mvc first

              so this thread could be in stand by for a time

              again thanks for your time

              is sadly dont have and find a book to learn acegi , is really a important topic

              regards

              Comment


              • #8
                If you want to use a properties file then this should work fine. As for a book, there isn't one just yet.

                applicationContext.xml
                Code:
                	<bean id="userDetailsService" class="org.acegisecurity.userdetails.memory.InMemoryDaoImpl">
                		<property name="userProperties">
                			<bean class="org.springframework.beans.factory.config.PropertiesFactoryBean">
                				<property name="location" value="/WEB-INF/users.properties"/>
                			</bean>
                		</property>
                	</bean>
                users.properties
                Code:
                marissa=koala,ROLE_SUPERVISOR
                dianne=emu,ROLE_USER
                scott=wombat,ROLE_USER
                peter=opal,disabled,ROLE_USER

                Comment


                • #9
                  thanks again!!!

                  As for a book, there isn't one just yet.


                  this thread would be in stand by almost 2-3 days

                  regards

                  Comment


                  • #10
                    Originally posted by dr_pompeii View Post
                    this thread would be in stand by almost 2-3 days
                    Glad this is all useful to you. If you keep working on this stuff maybe you could write the first Acegi book .

                    Comment


                    • #11
                      hi karldmoore

                      Glad this is all useful to you
                      your help is really appreciate

                      If you keep working on this stuff maybe you could write the first Acegi book
                      mmm good idea, it seems that i can make a simple manual or model

                      yes, i can make a mini manual for this hell with acegi, lol

                      thanks and best wishes
                      Last edited by dr_pompeii; Mar 3rd, 2007, 08:21 AM.

                      Comment


                      • #12
                        I don't know if you've already looked at this, but AppFuse integrates lots of technologies for you. Just means you don't have to start from scratch everytime.

                        Comment


                        • #13
                          hi karldmoore

                          I don't know if you've already looked at this, but AppFuse integrates lots of technologies for you.
                          i never heard about that

                          Just means you don't have to start from scratch everytime.
                          good, thanks for the tip

                          tell me, after of researching in google i found these 2 links
                          http://appfuse.org/ and https://appfuse.dev.java.net/ , well what is the home page , is there abook for this????, do you have a other best link if i am wrong with both??

                          i guess that this has an integration for Acegi right?

                          thanks for your time
                          regards

                          Comment


                          • #14
                            This is the right link http://appfuse.org/. Appfuse uses Acegi security so it's all there integrated for you. There isn't a book yet, but there was a post on there that said someone was looking into writing one. The online documentation is pretty good though.

                            Comment


                            • #15
                              thanks

                              i will check all the documentation

                              thanks for your time

                              Comment

                              Working...
                              X