Acegi integration

(Difference between revisions)
Jump to: navigation, search
 
Line 14: Line 14:
 
             <list>
 
             <list>
 
                 <ref local="daoAuthenticationProvider"/>
 
                 <ref local="daoAuthenticationProvider"/>
 +
                <ref local="jdbcDaoImpl"/>
 
             </list>
 
             </list>
 
         </property>
 
         </property>
Line 39: Line 40:
 
         </property>
 
         </property>
 
         <property name="usersByUsernameQuery">
 
         <property name="usersByUsernameQuery">
             <value>SELECT user_name, user_password FROM cms_users WHERE user_name = ?
+
             <value>
 +
                SELECT user_name, user_password FROM cms_users WHERE user_name = ?
 
             </value>
 
             </value>
 
         </property>
 
         </property>
 
         <property name="authoritiesByUsernameQuery">
 
         <property name="authoritiesByUsernameQuery">
 
             <value>
 
             <value>
                 SELECT a.USER_ID AS USERNAME, ROLE_ID AS AUTHORITY FROM USER a, CMS_GROUPusers b, CMS_GROUPS c WHERE
+
                 select u.user_name, g.group_name from cms_users u,
                 b.USER_KEY = a.USER_KEY AND USER_NAME = ?
+
                cms_groups g, cms_groupusers gu
 +
                 where user_name = ? and u.user_id = gu.user_id
 +
                and gu.group_id = g.group_id
 
             </value>
 
             </value>
 
         </property>
 
         </property>
Line 233: Line 237:
 
----
 
----
  
 
+
Contact me on the OpenCms mailing list if you have questions...
*** Will update this page soon and often as I finalize acegi in my current project...
+
Mick Knutson
I still need to work out the InMemoryDaoImpl verse the JdbcDaoImpl implementation into the existing opencms data structure.
+
 
+
'''Specifically, I need help with these 2 queries:'''
+
 
+
<code>
+
        <property name="usersByUsernameQuery">
+
            <value>SELECT user_name, user_password, ENABLED_FLAG FROM cms_users WHERE user_name = ?
+
            </value>
+
        </property>
+
        <property name="authoritiesByUsernameQuery">
+
            <value>SELECT a.USER_ID AS USERNAME, ROLE_ID AS AUTHORITY FROM USER a, CMS_GROUPusers b, CMS_GROUPS c WHERE b.USER_KEY =
+
                a.USER_KEY AND USER_ID = ?
+
            </value>
+
        </property>
+
</code>
+

Revision as of 19:47, 7 February 2007

Integrating Spring Acegi into OpenCms to restrict access for Web Users.

1. Spring Framework needs to be integrated before we can continue. [link to another page here]

2. Crate applicationContext-acegi-security.xml

Invalid language.

You need to specify a language like this: <source lang="html">...</source>

Supported languages for syntax highlighting:

actionscript, ada, apache, applescript, asm, asp, autoit, bash, blitzbasic, bnf, c, c_mac, caddcl, cadlisp, cfdg, cfm, cpp, cpp-qt, csharp, css, d, delphi, diff, div, dos, eiffel, fortran, freebasic, gml, groovy, html4strict, idl, ini, inno, io, java, java5, javascript, latex, lisp, lua, matlab, mirc, mpasm, mysql, nsis, objc, ocaml, ocaml-brief, oobas, oracle8, pascal, perl, php, php-brief, plsql, python, qbasic, reg, robots, ruby, sas, scheme, sdlbasic, smalltalk, smarty, sql, tcl, text, thinbasic, tsql, vb, vbnet, vhdl, visualfoxpro, winbatch, xml, z80


3. modify opencms/WEB-INF/web.xml

Invalid language.

You need to specify a language like this: <source lang="html">...</source>

Supported languages for syntax highlighting:

actionscript, ada, apache, applescript, asm, asp, autoit, bash, blitzbasic, bnf, c, c_mac, caddcl, cadlisp, cfdg, cfm, cpp, cpp-qt, csharp, css, d, delphi, diff, div, dos, eiffel, fortran, freebasic, gml, groovy, html4strict, idl, ini, inno, io, java, java5, javascript, latex, lisp, lua, matlab, mirc, mpasm, mysql, nsis, objc, ocaml, ocaml-brief, oobas, oracle8, pascal, perl, php, php-brief, plsql, python, qbasic, reg, robots, ruby, sas, scheme, sdlbasic, smalltalk, smarty, sql, tcl, text, thinbasic, tsql, vb, vbnet, vhdl, visualfoxpro, winbatch, xml, z80

4. create acegilogin.jsp in opencms workplace

<code> <h1>Acegi Login</h1> <%-- this form-login-page form is also used as the form-error-page to ask for a login again. --%> <c:if test="${not empty param.login_error}"> <font color="red"> Your login attempt was not successful, try again.<BR><BR> Reason: <%= ((AuthenticationException) session.getAttribute(AbstractProcessingFilter.ACEGI_SECURITY_LAST_EXCEPTION_KEY)).getMessage() %> </font> </c:if> <form id="loginForm" action="<c:url value='j_acegi_security_check'/>" method="POST"> <table> <tr><td>User:</td><td><input type='text' name='j_username' <c:if test="${not empty param.login_error}"> value='<%= session.getAttribute(AuthenticationProcessingFilter.ACEGI_SECURITY_LAST_USERNAME_KEY) %>' </c:if>></td></tr> <tr><td>Password:</td><td><input type='password' name='j_password'></td></tr> <tr><td colspan='2'><input name="submit" type="submit"></td></tr> </table> </form> </code>


5. Add the following jar's in the opencms/WEB-INF/lib/*

  • acegi-security-1.0.3.jar
  • aopalliance-1.0.jar
  • asm-1.5.3.jar
  • asm-all-2.2.3.jar
  • asm-attrs-1.5.3.jar
  • aspectjrt-1.5.2a.jar
  • cglib-2.1_3.jar
  • cglib-nodep-2.1_3.jar
  • commons-lang-2.1.jar
  • hibernate-3.2.1.ga.jar
  • spring-2.0.jar
  • standard-1.1.2.jar



Contact me on the OpenCms mailing list if you have questions... Mick Knutson

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox