Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to add MD5 hash into spring security
    text
    copied!<p>I want to add Md5 hash into springsecuritycontext.xml , I still dont know how to tell Spring to connect with my database and hash my passwords and how can I tell him that he have to compare after that the clear password with the hashing one in order to connect to the application! </p> <p>This is my springsecuritycontext.xml and my <code>web.xml</code> I need an explication step by step.</p> <p>My web.xml :</p> <pre><code> &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.5" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"&gt; --&gt; &lt;filter&gt; &lt;filter-name&gt;springSecurityFilterChain&lt;/filter-name&gt; &lt;filter-class&gt;org.springframework.web.filter.DelegatingFilterProxy&lt;/filter-class&gt; &lt;/filter&gt; &lt;!-- Spring-Security is mapped to all URLs --&gt; &lt;filter-mapping&gt; &lt;filter-name&gt;springSecurityFilterChain&lt;/filter-name&gt; &lt;url-pattern&gt;&lt;/url-pattern&gt; &lt;/filter-mapping&gt; &lt;listener&gt; &lt;listener-class&gt; org.springframework.security.ui.session.HttpSessionEventPublisher&lt;/listener-class&gt; &lt;/listener&gt; &lt;!-- END SPRING-Security --&gt; &lt;context-param&gt; &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt; &lt;param-value&gt; classpath:applicationContext-db.xml, classpath:applicationContext-hibernate.xml, /WEB-INF/SpringSecurityContext.xml &lt;/param-value&gt; &lt;/context-param&gt; &lt;!-- START SPRING --&gt; &lt;listener&gt; &lt;display-name&gt;Spring Context Loader&lt;/display-name&gt; &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt; &lt;/listener&gt; &lt;listener&gt; &lt;listener-class&gt; org.springframework.web.context.request.RequestContextListener&lt;/listener-class&gt; &lt;/listener&gt; &lt;!-- END Spring --&gt; &lt;context-param&gt; &lt;description&gt;Report resources(design files or document files) directory for preview. Default to ${Context Root}&lt;/description&gt; &lt;param-name&gt;BIRT_VIEWER_WORKING_FOLDER&lt;/param-name&gt; &lt;param-value /&gt; &lt;/context-param&gt; &lt;context-param&gt; &lt;description&gt;Report engine log level.( ALL|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST|OFF )&lt;/description&gt; &lt;param-name&gt;BIRT_VIEWER_LOG_LEVEL&lt;/param-name&gt; &lt;param-value&gt;WARNING&lt;/param-value&gt; &lt;/context-param&gt; &lt;context-param&gt; &lt;description&gt;Directory to store all birt report script libraries (JARs). Default to ${Context Root}/scriptlib&lt;/description&gt; &lt;param-name&gt;BIRT_VIEWER_SCRIPTLIB_DIR&lt;/param-name&gt; &lt;param-value&gt;WEB-INF/report-engine/scriptlib&lt;/param-value&gt; &lt;/context-param&gt; &lt;context-param&gt; &lt;description&gt;If force optimized HTML output.Default to true&lt;/description&gt; &lt;param-name&gt;HTML_ENABLE_AGENTSTYLE_ENGINE&lt;/param-name&gt; &lt;param-value&gt;true&lt;/param-value&gt; &lt;/context-param&gt; &lt;context-param&gt; &lt;description&gt;Report Engine logs directory. Default to ${Context Root}/logs&lt;/description&gt; &lt;param-name&gt;BIRT_VIEWER_LOG_DIR&lt;/param-name&gt; &lt;param-value&gt;WEB-INF/report-engine/logs&lt;/param-value&gt; &lt;/context-param&gt; &lt;context-param&gt; &lt;description&gt;Resource location directory(library files, images files or others). Default to ${Context Root}&lt;/description&gt; &lt;param-name&gt;BIRT_RESOURCE_PATH&lt;/param-name&gt; &lt;param-value /&gt; &lt;/context-param&gt; &lt;context-param&gt; &lt;description&gt;Output images/charts directory. Default to ${Context Root}/report/images&lt;/description&gt; &lt;param-name&gt;BIRT_VIEWER_IMAGE_DIR&lt;/param-name&gt; &lt;param-value&gt;WEB-INF/report-engine/images&lt;/param-value&gt; &lt;/context-param&gt; &lt;context-param&gt; &lt;description&gt;BIRT viewer extended configuration file&lt;/description&gt; &lt;param-name&gt;BIRT_VIEWER_CONFIG_FILE&lt;/param-name&gt; &lt;param-value&gt;WEB-INF/report-engine/viewer.properties&lt;/param-value&gt; &lt;/context-param&gt; &lt;context-param&gt; &lt;description&gt;If always overwrite generated document file. Default to true&lt;/description&gt; &lt;param-name&gt;BIRT_OVERWRITE_DOCUMENT&lt;/param-name&gt; &lt;param-value&gt;true&lt;/param-value&gt; &lt;/context-param&gt; &lt;context-param&gt; &lt;description&gt;Dataset rows limited when preview report. Default to return all rows&lt;/description&gt; &lt;param-name&gt;BIRT_VIEWER_MAX_ROWS&lt;/param-name&gt; &lt;param-value /&gt; &lt;/context-param&gt; &lt;context-param&gt; &lt;description&gt;The generated document files directory. Default to ${Context Root}/documents&lt;/description&gt; &lt;param-name&gt;BIRT_VIEWER_DOCUMENT_FOLDER&lt;/param-name&gt; &lt;param-value&gt;WEB-INF/report-engine/documents&lt;/param-value&gt; &lt;/context-param&gt; &lt;context-param&gt; &lt;description&gt;If turn on the function that supports print on the server side(ON|OFF).Default to on.&lt;/description&gt; &lt;param-name&gt;BIRT_VIEWER_PRINT_SERVERSIDE&lt;/param-name&gt; &lt;param-value&gt;ON&lt;/param-value&gt; &lt;/context-param&gt; &lt;context-param&gt; &lt;description&gt;Default locale setting&lt;/description&gt; &lt;param-name&gt;BIRT_VIEWER_LOCALE&lt;/param-name&gt; &lt;param-value&gt;en-US&lt;/param-value&gt; &lt;/context-param&gt; &lt;context-param&gt; &lt;description&gt;If usr can only access the reprot resources under working folder. Default is false&lt;/description&gt; &lt;param-name&gt;WORKING_FOLDER_ACCESS_ONLY&lt;/param-name&gt; &lt;param-value&gt;false&lt;/param-value&gt; &lt;/context-param&gt; &lt;listener&gt; &lt;listener-class&gt;org.eclipse.birt.report.listener.ViewerHttpSessionListener&lt;/listener-class&gt; &lt;/listener&gt; &lt;listener&gt; &lt;listener-class&gt;org.eclipse.birt.report.listener.ViewerServletContextListener&lt;/listener-class&gt; &lt;/listener&gt; &lt;listener&gt; &lt;listener-class&gt;org.zkoss.zk.ui.http.HttpSessionListener&lt;/listener-class&gt; &lt;/listener&gt; &lt;listener&gt; &lt;listener-class&gt;org.zkoss.jsp.spec.JspFactoryContextListener&lt;/listener-class&gt; &lt;/listener&gt; &lt;servlet&gt; &lt;servlet-name&gt;zkLoader&lt;/servlet-name&gt; &lt;servlet-class&gt;org.zkoss.zk.ui.http.DHtmlLayoutServlet&lt;/servlet-class&gt; &lt;init-param&gt; &lt;param-name&gt;update-uri&lt;/param-name&gt; &lt;param-value&gt;/zkau&lt;/param-value&gt; &lt;/init-param&gt; &lt;load-on-startup&gt;1&lt;/load-on-startup&gt; &lt;/servlet&gt; &lt;servlet&gt; &lt;servlet-name&gt;auEngine&lt;/servlet-name&gt; &lt;servlet-class&gt;org.zkoss.zk.au.http.DHtmlUpdateServlet&lt;/servlet-class&gt; &lt;/servlet&gt; &lt;!-- &lt;servlet&gt; &lt;servlet-name&gt;action&lt;/servlet-name&gt; &lt;servlet-class&gt;org.apache.struts.action.ActionServlet&lt;/servlet-class&gt; &lt;init-param&gt; &lt;param-name&gt;config&lt;/param-name&gt; &lt;param-value&gt;/WEB-INF/struts-config.xml&lt;/param-value&gt; &lt;/init-param&gt; &lt;init-param&gt; &lt;param-name&gt;debug&lt;/param-name&gt; &lt;param-value&gt;3&lt;/param-value&gt; &lt;/init-param&gt; &lt;init-param&gt; &lt;param-name&gt;detail&lt;/param-name&gt; &lt;param-value&gt;3&lt;/param-value&gt; &lt;/init-param&gt; &lt;load-on-startup&gt;0&lt;/load-on-startup&gt; &lt;/servlet&gt; --&gt;&lt;servlet&gt; &lt;servlet-name&gt;EngineServlet&lt;/servlet-name&gt; &lt;servlet-class&gt;org.eclipse.birt.report.servlet.BirtEngineServlet&lt;/servlet-class&gt; &lt;load-on-startup&gt;0&lt;/load-on-startup&gt; &lt;/servlet&gt; &lt;servlet&gt; &lt;servlet-name&gt;ViewerServlet&lt;/servlet-name&gt; &lt;servlet-class&gt;org.eclipse.birt.report.servlet.ViewerServlet&lt;/servlet-class&gt; &lt;load-on-startup&gt;0&lt;/load-on-startup&gt; &lt;/servlet&gt; &lt;servlet&gt; &lt;servlet-name&gt;CommonsFileUploadServlet&lt;/servlet-name&gt; &lt;servlet-class&gt;com.dam.objets.CommonsFileUploadServlet&lt;/servlet-class&gt; &lt;/servlet&gt; &lt;servlet&gt; &lt;servlet-name&gt;Chapter2Servlet&lt;/servlet-name&gt; &lt;servlet-class&gt;com.dam.objets.Chapter2Servlet&lt;/servlet-class&gt; &lt;/servlet&gt; &lt;servlet-mapping&gt; &lt;servlet-name&gt;Chapter2Servlet&lt;/servlet-name&gt; &lt;url-pattern&gt;/report&lt;/url-pattern&gt; &lt;/servlet-mapping&gt; &lt;servlet&gt; &lt;servlet-name&gt;UploadServlet&lt;/servlet-name&gt; &lt;servlet-class&gt;com.dam.objets.UploadServlet&lt;/servlet-class&gt; &lt;/servlet&gt; &lt;servlet-mapping&gt; &lt;servlet-name&gt;UploadServlet&lt;/servlet-name&gt; &lt;url-pattern&gt;/Upload&lt;/url-pattern&gt; &lt;/servlet-mapping&gt; &lt;servlet-mapping&gt; &lt;servlet-name&gt;CommonsFileUploadServlet&lt;/servlet-name&gt; &lt;url-pattern&gt;/Commonsfileuploadservlet&lt;/url-pattern&gt; &lt;/servlet-mapping&gt; &lt;servlet-mapping&gt; &lt;servlet-name&gt;zkLoader&lt;/servlet-name&gt; &lt;url-pattern&gt;*.zul&lt;/url-pattern&gt; &lt;/servlet-mapping&gt; &lt;servlet-mapping&gt; &lt;servlet-name&gt;zkLoader&lt;/servlet-name&gt; &lt;url-pattern&gt;*.zhtml&lt;/url-pattern&gt; &lt;/servlet-mapping&gt; &lt;servlet-mapping&gt; &lt;servlet-name&gt;auEngine&lt;/servlet-name&gt; &lt;url-pattern&gt;/zkau/*&lt;/url-pattern&gt; &lt;/servlet-mapping&gt; &lt;!--&lt;servlet-mapping&gt; &lt;servlet-name&gt;action&lt;/servlet-name&gt; &lt;url-pattern&gt;*.do&lt;/url-pattern&gt; &lt;/servlet-mapping&gt; --&gt;&lt;servlet-mapping&gt; &lt;servlet-name&gt;EngineServlet&lt;/servlet-name&gt; &lt;url-pattern&gt;/download&lt;/url-pattern&gt; &lt;/servlet-mapping&gt; &lt;servlet-mapping&gt; &lt;servlet-name&gt;EngineServlet&lt;/servlet-name&gt; &lt;url-pattern&gt;/preview&lt;/url-pattern&gt; &lt;/servlet-mapping&gt; &lt;servlet-mapping&gt; &lt;servlet-name&gt;ViewerServlet&lt;/servlet-name&gt; &lt;url-pattern&gt;/frameset&lt;/url-pattern&gt; &lt;/servlet-mapping&gt; &lt;servlet-mapping&gt; &lt;servlet-name&gt;EngineServlet&lt;/servlet-name&gt; &lt;url-pattern&gt;/parameter&lt;/url-pattern&gt; &lt;/servlet-mapping&gt; &lt;servlet-mapping&gt; &lt;servlet-name&gt;ViewerServlet&lt;/servlet-name&gt; &lt;url-pattern&gt;/run&lt;/url-pattern&gt; &lt;/servlet-mapping&gt; &lt;welcome-file-list&gt; &lt;welcome-file&gt;index.zul&lt;/welcome-file&gt; &lt;/welcome-file-list&gt; &lt;jsp-config&gt; &lt;taglib&gt; &lt;taglib-uri&gt;/birt.tld&lt;/taglib-uri&gt; &lt;taglib-location&gt;/WEB-INF/report-engine/tlds/birt.tld&lt;/taglib-location&gt; &lt;/taglib&gt; &lt;/jsp-config&gt; &lt;/web-app&gt; </code></pre> <p>Spring security content: </p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;!-- Spring namespace-based configuration --&gt; &lt;beans:beans xmlns="http://www.springframework.org/schema/security" xmlns:beans="http://www.springframework.org/schema/beans" xmlns:zksp="http://www.zkoss.org/2008/zkspring" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-2.0.1.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd"&gt; &lt;global-method-security secured-annotations="enabled" /&gt; &lt;http auto-config="true"&gt; &lt;form-login login-page="/index.zul" authentication-failure-url="/index.zul?login_error=1" default-target-url="/AccueilIntranet.zul" /&gt; &lt;logout logout-url="/j_spring_logout" logout-success-url="/index.zul" /&gt; &lt;intercept-url pattern="/pages/**" access="IS_AUTHENTICATED_REMEMBERED" filters="none" /&gt; &lt;intercept-url pattern="/WEB-INF/pages/**" access="IS_AUTHENTICATED_REMEMBERED" filters="none"/&gt; &lt;intercept-url pattern="/**" access="IS_AUTHENTICATED_ANONYMOUSLY" filters="none"/&gt; &lt;!-- ### Per user one session !! ### --&gt; &lt;concurrent-session-control max-sessions="1" /&gt; &lt;/http&gt; &lt;authentication-provider user-service-ref="myUserDetailsService"&gt; &lt;/authentication-provider&gt; &lt;beans:bean id="myUserDetailsService" class="ma.dyaralmansour.zkgui.policy.PolicyManager"&gt; &lt;beans:property name="userService" ref="userService" /&gt; &lt;/beans:bean&gt; &lt;beans:bean id="LoginLoggingPolicyService" class="ma.dyaralmansour.zkgui.policy.LoginLoggingPolicyService"&gt; &lt;beans:property name="loginLoggingService" ref="loginLoggingService" /&gt; &lt;/beans:bean&gt; &lt;aop:config&gt; &lt;aop:aspect id="LoginLoggingAspect" ref="LoginLoggingPolicyService"&gt; &lt;aop:pointcut id="authPointcut" expression="execution(public org.springframework.security.Authentication org.springframework.security.providers.AuthenticationProvider.authenticate(org.springframework.security.Authentication))" /&gt; &lt;aop:around pointcut-ref="authPointcut" method="loginLogging" /&gt; &lt;/aop:aspect&gt; &lt;/aop:config&gt; &lt;/beans:beans&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload