Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Code:
- <?xml version="1.0" encoding="UTF-8"?>
- <beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:facebook="http://www.springframework.org/schema/social/facebook"
- xmlns:twitter="http://www.springframework.org/schema/social/twitter"
- xmlns:social="http://www.springframework.org/schema/social"
- xmlns:c="http://www.springframework.org/schema/c"
- xmlns:context="http://www.springframework.org/schema/context"
- xsi:schemaLocation="http://www.springframework.org/schema/social/facebook http://www.springframework.org/schema/social/spring-social-facebook.xsd
- http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/social/twitter http://www.springframework.org/schema/social/spring-social-twitter.xsd
- http://www.springframework.org/schema/social http://www.springframework.org/schema/social/spring-social.xsd
- http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd">
- <context:property-placeholder location="classpath:social.properties" />
- <facebook:config app-id="${facebook.clientId}" app-secret="${facebook.clientSecret}" />
- <twitter:config app-id="${twitter.consumerKey}" app-secret="${twitter.consumerSecret}"/>
- <social:jdbc-connection-repository/>
- <bean id="userIdSource" class="org.springframework.social.security.AuthenticationNameUserIdSource" />
- <bean id="connectController" class="org.springframework.social.connect.web.ConnectController" autowire="constructor">
- </bean>
- <bean id="psc" class="org.springframework.social.connect.web.ProviderSignInController" autowire="constructor">
- </bean>
- <bean id="signInAdapter" class="Jibberish.webapp.social.user.signin.SimpleSignInAdapter" autowire="constructor" />
- <bean id="disconnectController" class="org.springframework.social.facebook.web.DisconnectController"
- c:_0-ref="usersConnectionRepository" c:_1="${facebook.clientSecret}" />
- </beans>
- security.xml
- Code:
- <?xml version="1.0" encoding="UTF-8"?>
- <beans:beans xmlns="http://www.springframework.org/schema/security"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:beans="http://www.springframework.org/schema/beans" xmlns:p="http://www.springframework.org/schema/p"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
- http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd">
- <http pattern="/images/**" security="none"/>
- <http pattern="/styles/**" security="none"/>
- <http pattern="/scripts/**" security="none"/>
- <http auto-config="true">
- <intercept-url pattern="/app/admin/**" access="ROLE_ADMIN"/>
- <intercept-url pattern="/app/passwordHint*" access="ROLE_ANONYMOUS,ROLE_ADMIN,ROLE_USER"/>
- <intercept-url pattern="/app/signup*" access="ROLE_ANONYMOUS,ROLE_ADMIN,ROLE_USER"/>
- <intercept-url pattern="/app/signin/**" access="ROLE_ANONYMOUS,ROLE_ADMIN,ROLE_USER"/>
- <intercept-url pattern="/app/connect/**" access="ROLE_ANONYMOUS,ROLE_ADMIN,ROLE_USER"/>
- <intercept-url pattern="/app/auth/**" access="ROLE_ANONYMOUS,ROLE_ADMIN,ROLE_USER" />
- <intercept-url pattern="/app/consumer*" access="ROLE_ANONYMOUS,ROLE_ADMIN,ROLE_USER"/>
- <intercept-url pattern="/app/disclaimer*" access="ROLE_ANONYMOUS,ROLE_ADMIN,ROLE_USER"/>
- <intercept-url pattern="/app/submitlead*" access="ROLE_ANONYMOUS,ROLE_ADMIN,ROLE_USER"/>
- <intercept-url pattern="/app/emailNotification*" access="ROLE_ANONYMOUS,ROLE_ADMIN,ROLE_USER"/>
- <intercept-url pattern="/app/lead*" access="ROLE_ANONYMOUS,ROLE_ADMIN,ROLE_USER"/>
- <intercept-url pattern="/app/export*" access="ROLE_ANONYMOUS,ROLE_ADMIN,ROLE_USER"/>
- <intercept-url pattern="/app/**" access="ROLE_ADMIN,ROLE_USER"/>
- <form-login login-page="/login" authentication-failure-url="/login?error=true" login-processing-url="/j_security_check"/>
- <remember-me user-service-ref="userDao" key="e37f4b31-0c45-11dd-bd0b-0800200c9a66"/>
- <!-- Spring Social Security authentication filter -->
- <custom-filter ref="socialAuthenticationFilter" before="PRE_AUTH_FILTER" />
- </http>
- <authentication-manager alias="authenticationManager">
- <authentication-provider user-service-ref="userDao">
- <password-encoder ref="passwordEncoder">
- <salt-source ref="saltSource"/>
- </password-encoder>
- </authentication-provider>
- <authentication-provider ref="socialAuthenticationProvider"/>
- </authentication-manager>
- <beans:bean id="saltSource" class="org.springframework.security.authentication.dao.ReflectionSaltSource"
- p:userPropertyToUse="username"/>
- <!-- Override the default password-encoder (SHA) by uncommenting the following and changing the class -->
- <bean id="passwordEncoder" class="org.springframework.security.authentication.encoding.ShaPasswordEncoder"/>
- <global-method-security>
- <protect-pointcut expression="execution(* *..service.UserManager.getUsers(..))" access="ROLE_ADMIN"/>
- <protect-pointcut expression="execution(* *..service.UserManager.removeUser(..))" access="ROLE_ADMIN"/>
- </global-method-security>
- <jdbc-user-service id="userDetailsService"
- data-source-ref="dataSource"
- users-by-username-query="select username, password, true from app_user where username = ?"
- authorities-by-username-query="select username, 'USER_ROLE' from app_user where username = ?"/>
- <beans:bean id="textEncryptor" class="org.springframework.security.crypto.encrypt.Encryptors"
- factory-method="noOpText" />
- <!-- <beans:bean id="passwordEncoder" class="org.springframework.security.crypto.password.NoOpPasswordEncoder"
- factory-method="getInstance" /> -->
- </beans:beans>
- social-security.xml
- Code:
- <?xml version="1.0" encoding="UTF-8"?>
- <beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:p="http://www.springframework.org/schema/p"
- xmlns:c="http://www.springframework.org/schema/c"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
- <bean id="socialAuthenticationFilter" class="org.springframework.social.security.SocialAuthenticationFilter"
- c:_0-ref="authenticationManager"
- c:_1-ref="userIdSource"
- c:_2-ref="usersConnectionRepository"
- c:_3-ref="connectionFactoryLocator"
- p:signupUrl="/signup"
- p:rememberMeServices-ref="org.springframework.security.web.authentication.rememberme.TokenBasedRememberMeServices#0" /> <!-- TODO: Figure out how to wire this without this name -->
- <bean id="socialAuthenticationProvider" class="org.springframework.social.security.SocialAuthenticationProvider"
- c:_0-ref="usersConnectionRepository"
- c:_1-ref="socialUsersDetailService" />
- <bean id="socialUsersDetailService" class="Jibberish.webapp.social.user.security.SimpleSocialUsersDetailService"
- c:_-ref="userDetailsService" />
- </beans>
- urlrewrite.xml
- Code:
- <?xml version="1.0" encoding="utf-8"?>
- <!DOCTYPE urlrewrite PUBLIC "-//tuckey.org//DTD UrlRewrite 3.0//EN"
- "http://www.tuckey.org/res/dtds/urlrewrite3.0.dtd">
- <urlrewrite default-match-type="wildcard">
- <rule match-type="regex">
- <from>^/admin/user/(.*)\$</from>
- <to type="forward">/app/admin/userform?id=$1&from=list</to>
- </rule>
- <!-- The following fixes a CSS bug in CXF. -->
- <rule match-type="regex">
- <from>^/services//(.*)$</from>
- <to type="forward">/services/$1</to>
- </rule>
- <!-- Add rules here for anything that shouldn't be served up by Spring MVC. -->
- <rule>
- <from>/</from>
- <to type="redirect" last="true">dashboard</to>
- </rule>
- <rule>
- <from>/app/**</from>
- <to last="true" type="redirect">%{context-path}/$1</to>
- </rule>
- <rule>
- <from>/j_security_check</from>
- <to>/j_security_check</to>
- </rule>
- <rule>
- <from>/login*</from>
- <to>/login.jsp</to>
- </rule>
- <rule>
- <from>/logout*</from>
- <to>/logout.jsp</to>
- </rule>
- <!-- Spring MVC -->
- <rule>
- <from>/**</from>
- <to>/app/$1</to>
- </rule>
- <outbound-rule>
- <from>/app/**</from>
- <to>/$1</to>
- </outbound-rule>
- <!-- Remove JSESSIONID from URLs when cookies disabled -->
- <!-- http://stackoverflow.com/questions/962729/is-it-possible-to-disable-jsessionid-in-tomcat-servlet -->
- <outbound-rule encodefirst="true" match-type="regex">
- <name>Strip URL Session ID's</name>
- <from>^(.*?)(?:\;jsessionid=[^\?#]*)?(\?[^#]*)?(#.*)?$</from>
- <to>$1$2$3</to>
- </outbound-rule>
- </urlrewrite>
- web.xml
- <?xml version="1.0" encoding="UTF-8"?>
- <web-app xmlns="http://java.sun.com/xml/ns/javaee"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
- version="3.0">
- <display-name>Jibberish</display-name>
- <distributable/>
- <!-- precompiled jsp mappings -->
- <!-- Define the basename for a resource bundle for I18N -->
- <context-param>
- <param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
- <param-value>ApplicationResources</param-value>
- </context-param>
- <!-- Fallback locale if no bundles found for browser's preferred locale -->
- <!-- Force a single locale using param-name 'javax.servlet.jsp.jstl.fmt.locale' -->
- <context-param>
- <param-name>javax.servlet.jsp.jstl.fmt.fallbackLocale</param-name>
- <param-value>en</param-value>
- </context-param>
- <!-- Context Configuration locations for Spring XML files -->
- <context-param>
- <param-name>contextConfigLocation</param-name>
- <param-value>
- classpath:/applicationContext-resources.xml
- classpath:/applicationContext-dao.xml
- classpath:/applicationContext-service.xml
- classpath:/social-security.xml
- classpath:/social.xml
- classpath*:/applicationContext.xml
- /WEB-INF/applicationContext*.xml
- /WEB-INF/cxf-servlet.xml
- /WEB-INF/security.xml
- </param-value>
- </context-param>
- <filter>
- <filter-name>rewriteFilter</filter-name>
- <filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class>
- <!-- sets up log level (will be logged to context log)
- can be: TRACE, DEBUG, INFO (default), WARN, ERROR, FATAL, log4j, commons, sysout:{level} (ie, sysout:DEBUG)
- if you are having trouble using normal levels use sysout:DEBUG -->
- <init-param>
- <param-name>logLevel</param-name>
- <param-value>commons</param-value>
- </init-param>
- <!-- set the amount of seconds the conf file will be checked for reload
- can be a valid integer (0 denotes check every time,
- -1 denotes no reload check, default -1) -->
- <init-param>
- <param-name>confReloadCheckInterval</param-name>
- <param-value>-1</param-value>
- </init-param>
- </filter>
- <filter>
- <filter-name>securityFilter</filter-name>
- <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
- <init-param>
- <param-name>targetBeanName</param-name>
- <param-value>springSecurityFilterChain</param-value>
- </init-param>
- </filter>
- <filter>
- <filter-name>hiddenHttpMethodFilter</filter-name>
- <filter-class>org.springframework.web.filter.HiddenHttpMethodFilter</filter-class>
- </filter>
- <filter-mapping>
- <filter-name>sitemesh</filter-name>
- <url-pattern>/*</url-pattern>
- <dispatcher>REQUEST</dispatcher>
- <dispatcher>FORWARD</dispatcher>
- </filter-mapping>
- <filter-mapping>
- <filter-name>encodingFilter</filter-name>
- <url-pattern>/*</url-pattern>
- </filter-mapping>
- <filter-mapping>
- <filter-name>lazyLoadingFilter</filter-name>
- <url-pattern>/*</url-pattern>
- </filter-mapping>
- <filter-mapping>
- <filter-name>localeFilter</filter-name>
- <url-pattern>/*</url-pattern>
- </filter-mapping>
- <!--filter-mapping>
- <filter-name>gzipFilter</filter-name>
- <url-pattern>/*</url-pattern>
- </filter-mapping-->
- <filter-mapping>
- <filter-name>rewriteFilter</filter-name>
- <url-pattern>/*</url-pattern>
- </filter-mapping>
- <filter-mapping>
- <filter-name>securityFilter</filter-name>
- <url-pattern>/*</url-pattern>
- <dispatcher>REQUEST</dispatcher>
- <dispatcher>FORWARD</dispatcher>
- <dispatcher>INCLUDE</dispatcher>
- </filter-mapping>
- <filter-mapping>
- <filter-name>exportFilter</filter-name>
- <url-pattern>/app/*</url-pattern>
- </filter-mapping>
- <filter-mapping>
- <filter-name>hiddenHttpMethodFilter</filter-name>
- <url-pattern>/*</url-pattern>
- </filter-mapping>
- <listener>
- <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
- </listener>
- <listener>
- <listener-class>org.springframework.web.util.IntrospectorCleanupListener</listener-class>
- </listener>
- <listener>
- <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
- </listener>
- <listener>
- <listener-class>Jibberish.webapp.listener.StartupListener</listener-class>
- </listener>
- <listener>
- <listener-class>Jibberish.webapp.listener.UserCounterListener</listener-class>
- </listener>
- <!--<listener>
- <listener-class>Jibberish.webapp.jsp.EscapeXmlELResolverListener</listener-class>
- </listener>-->
- <listener>
- <listener-class>net.sf.navigator.menu.MenuContextListener</listener-class>
- </listener>
- <servlet>
- <servlet-name>dispatcher</servlet-name>
- <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
- <init-param>
- <param-name>dispatchOptionsRequest</param-name>
- <param-value>true</param-value>
- </init-param>
- <load-on-startup>1</load-on-startup>
- </servlet>
- <servlet-mapping>
- <servlet-name>dispatcher</servlet-name>
- <url-pattern>/app/*</url-pattern>
- </servlet-mapping>
- <welcome-file-list>
- <welcome-file>index.jsp</welcome-file>
- </welcome-file-list>
- <error-page>
- <error-code>500</error-code>
- <location>/error.jsp</location>
- </error-page>
- <error-page>
- <error-code>400</error-code>
- <location>/index.jsp</location>
- </error-page>
- <error-page>
- <error-code>403</error-code>
- <location>/403.jsp</location>
- </error-page>
- <error-page>
- <error-code>404</error-code>
- <location>/404.jsp</location>
- </error-page>
- <jsp-config>
- <jsp-property-group>
- <url-pattern>*.jsp</url-pattern>
- <trim-directive-whitespaces>true</trim-directive-whitespaces>
- </jsp-property-group>
- </jsp-config>
- <session-config>
- <session-timeout>15</session-timeout>
- <cookie-config>
- <http-only>true</http-only>
- <!--<secure>true</secure>-->
- </cookie-config>
- <tracking-mode>COOKIE</tracking-mode>
- </session-config>
- </web-app>
Advertisement
Add Comment
Please, Sign In to add comment