Guest User

Untitled

a guest
Nov 9th, 2013
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.98 KB | None | 0 0
  1. Code:
  2. <?xml version="1.0" encoding="UTF-8"?>
  3. <beans xmlns="http://www.springframework.org/schema/beans"
  4. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  5. xmlns:facebook="http://www.springframework.org/schema/social/facebook"
  6. xmlns:twitter="http://www.springframework.org/schema/social/twitter"
  7. xmlns:social="http://www.springframework.org/schema/social"
  8. xmlns:c="http://www.springframework.org/schema/c"
  9. xmlns:context="http://www.springframework.org/schema/context"
  10. xsi:schemaLocation="http://www.springframework.org/schema/social/facebook http://www.springframework.org/schema/social/spring-social-facebook.xsd
  11. http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
  12. http://www.springframework.org/schema/social/twitter http://www.springframework.org/schema/social/spring-social-twitter.xsd
  13. http://www.springframework.org/schema/social http://www.springframework.org/schema/social/spring-social.xsd
  14. http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd">
  15.  
  16.  
  17. <context:property-placeholder location="classpath:social.properties" />
  18.  
  19. <facebook:config app-id="${facebook.clientId}" app-secret="${facebook.clientSecret}" />
  20. <twitter:config app-id="${twitter.consumerKey}" app-secret="${twitter.consumerSecret}"/>
  21.  
  22.  
  23. <social:jdbc-connection-repository/>
  24. <bean id="userIdSource" class="org.springframework.social.security.AuthenticationNameUserIdSource" />
  25.  
  26. <bean id="connectController" class="org.springframework.social.connect.web.ConnectController" autowire="constructor">
  27. </bean>
  28.  
  29. <bean id="psc" class="org.springframework.social.connect.web.ProviderSignInController" autowire="constructor">
  30. </bean>
  31.  
  32. <bean id="signInAdapter" class="Jibberish.webapp.social.user.signin.SimpleSignInAdapter" autowire="constructor" />
  33.  
  34. <bean id="disconnectController" class="org.springframework.social.facebook.web.DisconnectController"
  35. c:_0-ref="usersConnectionRepository" c:_1="${facebook.clientSecret}" />
  36.  
  37.  
  38. </beans>
  39. security.xml
  40. Code:
  41. <?xml version="1.0" encoding="UTF-8"?>
  42. <beans:beans xmlns="http://www.springframework.org/schema/security"
  43. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  44. xmlns:beans="http://www.springframework.org/schema/beans" xmlns:p="http://www.springframework.org/schema/p"
  45. xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
  46. http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd">
  47.  
  48. <http pattern="/images/**" security="none"/>
  49. <http pattern="/styles/**" security="none"/>
  50. <http pattern="/scripts/**" security="none"/>
  51.  
  52. <http auto-config="true">
  53. <intercept-url pattern="/app/admin/**" access="ROLE_ADMIN"/>
  54. <intercept-url pattern="/app/passwordHint*" access="ROLE_ANONYMOUS,ROLE_ADMIN,ROLE_USER"/>
  55. <intercept-url pattern="/app/signup*" access="ROLE_ANONYMOUS,ROLE_ADMIN,ROLE_USER"/>
  56. <intercept-url pattern="/app/signin/**" access="ROLE_ANONYMOUS,ROLE_ADMIN,ROLE_USER"/>
  57. <intercept-url pattern="/app/connect/**" access="ROLE_ANONYMOUS,ROLE_ADMIN,ROLE_USER"/>
  58. <intercept-url pattern="/app/auth/**" access="ROLE_ANONYMOUS,ROLE_ADMIN,ROLE_USER" />
  59. <intercept-url pattern="/app/consumer*" access="ROLE_ANONYMOUS,ROLE_ADMIN,ROLE_USER"/>
  60. <intercept-url pattern="/app/disclaimer*" access="ROLE_ANONYMOUS,ROLE_ADMIN,ROLE_USER"/>
  61. <intercept-url pattern="/app/submitlead*" access="ROLE_ANONYMOUS,ROLE_ADMIN,ROLE_USER"/>
  62. <intercept-url pattern="/app/emailNotification*" access="ROLE_ANONYMOUS,ROLE_ADMIN,ROLE_USER"/>
  63. <intercept-url pattern="/app/lead*" access="ROLE_ANONYMOUS,ROLE_ADMIN,ROLE_USER"/>
  64. <intercept-url pattern="/app/export*" access="ROLE_ANONYMOUS,ROLE_ADMIN,ROLE_USER"/>
  65. <intercept-url pattern="/app/**" access="ROLE_ADMIN,ROLE_USER"/>
  66. <form-login login-page="/login" authentication-failure-url="/login?error=true" login-processing-url="/j_security_check"/>
  67. <remember-me user-service-ref="userDao" key="e37f4b31-0c45-11dd-bd0b-0800200c9a66"/>
  68. <!-- Spring Social Security authentication filter -->
  69. <custom-filter ref="socialAuthenticationFilter" before="PRE_AUTH_FILTER" />
  70. </http>
  71.  
  72. <authentication-manager alias="authenticationManager">
  73. <authentication-provider user-service-ref="userDao">
  74. <password-encoder ref="passwordEncoder">
  75. <salt-source ref="saltSource"/>
  76. </password-encoder>
  77. </authentication-provider>
  78. <authentication-provider ref="socialAuthenticationProvider"/>
  79. </authentication-manager>
  80.  
  81. <beans:bean id="saltSource" class="org.springframework.security.authentication.dao.ReflectionSaltSource"
  82. p:userPropertyToUse="username"/>
  83.  
  84. <!-- Override the default password-encoder (SHA) by uncommenting the following and changing the class -->
  85. <bean id="passwordEncoder" class="org.springframework.security.authentication.encoding.ShaPasswordEncoder"/>
  86.  
  87. <global-method-security>
  88. <protect-pointcut expression="execution(* *..service.UserManager.getUsers(..))" access="ROLE_ADMIN"/>
  89. <protect-pointcut expression="execution(* *..service.UserManager.removeUser(..))" access="ROLE_ADMIN"/>
  90. </global-method-security>
  91.  
  92. <jdbc-user-service id="userDetailsService"
  93. data-source-ref="dataSource"
  94. users-by-username-query="select username, password, true from app_user where username = ?"
  95. authorities-by-username-query="select username, 'USER_ROLE' from app_user where username = ?"/>
  96.  
  97. <beans:bean id="textEncryptor" class="org.springframework.security.crypto.encrypt.Encryptors"
  98. factory-method="noOpText" />
  99.  
  100. <!-- <beans:bean id="passwordEncoder" class="org.springframework.security.crypto.password.NoOpPasswordEncoder"
  101. factory-method="getInstance" /> -->
  102. </beans:beans>
  103. social-security.xml
  104. Code:
  105. <?xml version="1.0" encoding="UTF-8"?>
  106. <beans xmlns="http://www.springframework.org/schema/beans"
  107. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  108. xmlns:p="http://www.springframework.org/schema/p"
  109. xmlns:c="http://www.springframework.org/schema/c"
  110. xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
  111.  
  112. <bean id="socialAuthenticationFilter" class="org.springframework.social.security.SocialAuthenticationFilter"
  113. c:_0-ref="authenticationManager"
  114. c:_1-ref="userIdSource"
  115. c:_2-ref="usersConnectionRepository"
  116. c:_3-ref="connectionFactoryLocator"
  117. p:signupUrl="/signup"
  118. p:rememberMeServices-ref="org.springframework.security.web.authentication.rememberme.TokenBasedRememberMeServices#0" /> <!-- TODO: Figure out how to wire this without this name -->
  119.  
  120. <bean id="socialAuthenticationProvider" class="org.springframework.social.security.SocialAuthenticationProvider"
  121. c:_0-ref="usersConnectionRepository"
  122. c:_1-ref="socialUsersDetailService" />
  123.  
  124. <bean id="socialUsersDetailService" class="Jibberish.webapp.social.user.security.SimpleSocialUsersDetailService"
  125. c:_-ref="userDetailsService" />
  126.  
  127. </beans>
  128.  
  129. urlrewrite.xml
  130. Code:
  131. <?xml version="1.0" encoding="utf-8"?>
  132. <!DOCTYPE urlrewrite PUBLIC "-//tuckey.org//DTD UrlRewrite 3.0//EN"
  133. "http://www.tuckey.org/res/dtds/urlrewrite3.0.dtd">
  134.  
  135. <urlrewrite default-match-type="wildcard">
  136. <rule match-type="regex">
  137. <from>^/admin/user/(.*)\$</from>
  138. <to type="forward">/app/admin/userform?id=$1&amp;from=list</to>
  139. </rule>
  140. <!-- The following fixes a CSS bug in CXF. -->
  141. <rule match-type="regex">
  142. <from>^/services//(.*)$</from>
  143. <to type="forward">/services/$1</to>
  144. </rule>
  145.  
  146. <!-- Add rules here for anything that shouldn't be served up by Spring MVC. -->
  147. <rule>
  148. <from>/</from>
  149. <to type="redirect" last="true">dashboard</to>
  150. </rule>
  151. <rule>
  152. <from>/app/**</from>
  153. <to last="true" type="redirect">%{context-path}/$1</to>
  154. </rule>
  155. <rule>
  156. <from>/j_security_check</from>
  157. <to>/j_security_check</to>
  158. </rule>
  159. <rule>
  160. <from>/login*</from>
  161. <to>/login.jsp</to>
  162. </rule>
  163. <rule>
  164. <from>/logout*</from>
  165. <to>/logout.jsp</to>
  166. </rule>
  167.  
  168. <!-- Spring MVC -->
  169. <rule>
  170. <from>/**</from>
  171. <to>/app/$1</to>
  172. </rule>
  173. <outbound-rule>
  174. <from>/app/**</from>
  175. <to>/$1</to>
  176. </outbound-rule>
  177. <!-- Remove JSESSIONID from URLs when cookies disabled -->
  178. <!-- http://stackoverflow.com/questions/962729/is-it-possible-to-disable-jsessionid-in-tomcat-servlet -->
  179. <outbound-rule encodefirst="true" match-type="regex">
  180. <name>Strip URL Session ID's</name>
  181. <from>^(.*?)(?:\;jsessionid=[^\?#]*)?(\?[^#]*)?(#.*)?$</from>
  182. <to>$1$2$3</to>
  183. </outbound-rule>
  184. </urlrewrite>
  185.  
  186. web.xml
  187.  
  188. <?xml version="1.0" encoding="UTF-8"?>
  189. <web-app xmlns="http://java.sun.com/xml/ns/javaee"
  190. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  191. xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
  192. version="3.0">
  193.  
  194. <display-name>Jibberish</display-name>
  195. <distributable/>
  196.  
  197. <!-- precompiled jsp mappings -->
  198.  
  199. <!-- Define the basename for a resource bundle for I18N -->
  200. <context-param>
  201. <param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
  202. <param-value>ApplicationResources</param-value>
  203. </context-param>
  204. <!-- Fallback locale if no bundles found for browser's preferred locale -->
  205. <!-- Force a single locale using param-name 'javax.servlet.jsp.jstl.fmt.locale' -->
  206. <context-param>
  207. <param-name>javax.servlet.jsp.jstl.fmt.fallbackLocale</param-name>
  208. <param-value>en</param-value>
  209. </context-param>
  210. <!-- Context Configuration locations for Spring XML files -->
  211. <context-param>
  212. <param-name>contextConfigLocation</param-name>
  213. <param-value>
  214. classpath:/applicationContext-resources.xml
  215. classpath:/applicationContext-dao.xml
  216. classpath:/applicationContext-service.xml
  217. classpath:/social-security.xml
  218. classpath:/social.xml
  219. classpath*:/applicationContext.xml
  220. /WEB-INF/applicationContext*.xml
  221. /WEB-INF/cxf-servlet.xml
  222. /WEB-INF/security.xml
  223. </param-value>
  224. </context-param>
  225.  
  226.  
  227. <filter>
  228. <filter-name>rewriteFilter</filter-name>
  229. <filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class>
  230. <!-- sets up log level (will be logged to context log)
  231. can be: TRACE, DEBUG, INFO (default), WARN, ERROR, FATAL, log4j, commons, sysout:{level} (ie, sysout:DEBUG)
  232. if you are having trouble using normal levels use sysout:DEBUG -->
  233. <init-param>
  234. <param-name>logLevel</param-name>
  235. <param-value>commons</param-value>
  236. </init-param>
  237. <!-- set the amount of seconds the conf file will be checked for reload
  238. can be a valid integer (0 denotes check every time,
  239. -1 denotes no reload check, default -1) -->
  240. <init-param>
  241. <param-name>confReloadCheckInterval</param-name>
  242. <param-value>-1</param-value>
  243. </init-param>
  244. </filter>
  245. <filter>
  246. <filter-name>securityFilter</filter-name>
  247. <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
  248. <init-param>
  249. <param-name>targetBeanName</param-name>
  250. <param-value>springSecurityFilterChain</param-value>
  251. </init-param>
  252. </filter>
  253.  
  254. <filter>
  255. <filter-name>hiddenHttpMethodFilter</filter-name>
  256. <filter-class>org.springframework.web.filter.HiddenHttpMethodFilter</filter-class>
  257. </filter>
  258.  
  259. <filter-mapping>
  260. <filter-name>sitemesh</filter-name>
  261. <url-pattern>/*</url-pattern>
  262. <dispatcher>REQUEST</dispatcher>
  263. <dispatcher>FORWARD</dispatcher>
  264. </filter-mapping>
  265. <filter-mapping>
  266. <filter-name>encodingFilter</filter-name>
  267. <url-pattern>/*</url-pattern>
  268. </filter-mapping>
  269. <filter-mapping>
  270. <filter-name>lazyLoadingFilter</filter-name>
  271. <url-pattern>/*</url-pattern>
  272. </filter-mapping>
  273. <filter-mapping>
  274. <filter-name>localeFilter</filter-name>
  275. <url-pattern>/*</url-pattern>
  276. </filter-mapping>
  277. <!--filter-mapping>
  278. <filter-name>gzipFilter</filter-name>
  279. <url-pattern>/*</url-pattern>
  280. </filter-mapping-->
  281. <filter-mapping>
  282. <filter-name>rewriteFilter</filter-name>
  283. <url-pattern>/*</url-pattern>
  284. </filter-mapping>
  285. <filter-mapping>
  286. <filter-name>securityFilter</filter-name>
  287. <url-pattern>/*</url-pattern>
  288. <dispatcher>REQUEST</dispatcher>
  289. <dispatcher>FORWARD</dispatcher>
  290. <dispatcher>INCLUDE</dispatcher>
  291. </filter-mapping>
  292. <filter-mapping>
  293. <filter-name>exportFilter</filter-name>
  294. <url-pattern>/app/*</url-pattern>
  295. </filter-mapping>
  296. <filter-mapping>
  297. <filter-name>hiddenHttpMethodFilter</filter-name>
  298. <url-pattern>/*</url-pattern>
  299. </filter-mapping>
  300.  
  301. <listener>
  302. <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
  303. </listener>
  304. <listener>
  305. <listener-class>org.springframework.web.util.IntrospectorCleanupListener</listener-class>
  306. </listener>
  307. <listener>
  308. <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
  309. </listener>
  310. <listener>
  311. <listener-class>Jibberish.webapp.listener.StartupListener</listener-class>
  312. </listener>
  313. <listener>
  314. <listener-class>Jibberish.webapp.listener.UserCounterListener</listener-class>
  315. </listener>
  316. <!--<listener>
  317. <listener-class>Jibberish.webapp.jsp.EscapeXmlELResolverListener</listener-class>
  318. </listener>-->
  319. <listener>
  320. <listener-class>net.sf.navigator.menu.MenuContextListener</listener-class>
  321. </listener>
  322.  
  323. <servlet>
  324. <servlet-name>dispatcher</servlet-name>
  325. <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
  326. <init-param>
  327. <param-name>dispatchOptionsRequest</param-name>
  328. <param-value>true</param-value>
  329. </init-param>
  330. <load-on-startup>1</load-on-startup>
  331. </servlet>
  332.  
  333. <servlet-mapping>
  334. <servlet-name>dispatcher</servlet-name>
  335. <url-pattern>/app/*</url-pattern>
  336. </servlet-mapping>
  337.  
  338. <welcome-file-list>
  339. <welcome-file>index.jsp</welcome-file>
  340. </welcome-file-list>
  341.  
  342. <error-page>
  343. <error-code>500</error-code>
  344. <location>/error.jsp</location>
  345. </error-page>
  346. <error-page>
  347. <error-code>400</error-code>
  348. <location>/index.jsp</location>
  349. </error-page>
  350. <error-page>
  351. <error-code>403</error-code>
  352. <location>/403.jsp</location>
  353. </error-page>
  354. <error-page>
  355. <error-code>404</error-code>
  356. <location>/404.jsp</location>
  357. </error-page>
  358.  
  359. <jsp-config>
  360. <jsp-property-group>
  361. <url-pattern>*.jsp</url-pattern>
  362. <trim-directive-whitespaces>true</trim-directive-whitespaces>
  363. </jsp-property-group>
  364. </jsp-config>
  365.  
  366. <session-config>
  367. <session-timeout>15</session-timeout>
  368. <cookie-config>
  369. <http-only>true</http-only>
  370. <!--<secure>true</secure>-->
  371. </cookie-config>
  372. <tracking-mode>COOKIE</tracking-mode>
  373. </session-config>
  374. </web-app>
Advertisement
Add Comment
Please, Sign In to add comment