Samjay

social-security xmls

Feb 5th, 2014
249
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. security conif
  3.  
  4. <?xml version="1.0" encoding="UTF-8"?>
  5. <beans xmlns="http://www.springframework.org/schema/beans"
  6.     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
  7.     xmlns:mvc="http://www.springframework.org/schema/mvc"
  8.     xmlns:security="http://www.springframework.org/schema/security"
  9.     xmlns:p="http://www.springframework.org/schema/p"
  10.    xmlns:c="http://www.springframework.org/schema/c"
  11.     xmlns:aop="http://www.springframework.org/schema/aop"
  12.     xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
  13.         http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd
  14.         http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd
  15.         http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd
  16.         http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.2.xsd">
  17.  
  18.  
  19.     <security:http pattern="/resources/**" security="none"/>
  20.  
  21.     <!-- use-expression=true allows you to define access rights using methods from SecurityExpressionRoot ...-->
  22.     <security:http auto-config="true" use-expressions="true">  
  23.    
  24.         <security:intercept-url pattern="/login" access="permitAll"/>
  25.         <security:intercept-url pattern="/logout" access="permitAll" />
  26.         <security:intercept-url pattern="/public/**" access="permitAll" /> 
  27.         <security:intercept-url pattern="/user/signup" access="permitAll" />
  28.         <security:intercept-url pattern="/business/signup" access="permitAll" />
  29.        
  30.         <security:intercept-url pattern="/home" access="hasRole('ROLE_SITE_ADMIN')" />
  31.         <security:intercept-url pattern="/admin/**" access="hasRole('ROLE_SITE_ADMIN')" />
  32.        
  33.         <security:intercept-url pattern="/logged" access="hasAnyRole('ROLE_SITE_ADMIN','ROLE_COMPANY_ADMIN','ROLE_COMPANY_PROSPECT','ROLE_USER')" />
  34.         <security:intercept-url pattern="/business/**" access="hasAnyRole('ROLE_SITE_ADMIN','ROLE_COMPANY_ADMIN','ROLE_COMPANY_PROSPECT')" />
  35.         <security:intercept-url pattern="/user/**" access="hasAnyRole('ROLE_SITE_ADMIN','ROLE_COMPANY_ADMIN','ROLE_USER')" />
  36.        
  37.        
  38.         <security:form-login login-page="/login" default-target-url="/logged" authentication-failure-url="/login?errorLogin"/>
  39.         <security:logout logout-url="/logout" logout-success-url="/" />
  40.         <security:access-denied-handler error-page="/403"/>
  41.        
  42.     </security:http>
  43.    
  44.    
  45.     <bean id="socialAuthenticationFilter" class="org.springframework.social.security.SocialAuthenticationFilter"
  46.         c:_0-ref="authenticationManager"
  47.         c:_1-ref="userIdSource"
  48.         c:_2-ref="usersConnectionRepository"
  49.         c:_3-ref="connectionFactoryLocator"
  50.         p:signupUrl="/lbs-subscriber-portal/access/user/signup"/>
  51.  
  52.     <!-- Defining our custom authentication provider -->
  53.     <security:authentication-manager alias="authenticationManager">
  54.         <security:authentication-provider user-service-ref="repositoryBasedUserDetailsService">
  55.                 <security:password-encoder hash="md5"/>
  56.         </security:authentication-provider>
  57.        
  58.         <!-- Spring Social Security authentication provider -->
  59.         <security:authentication-provider ref="socialAuthenticationProvider" />
  60.        
  61.     </security:authentication-manager>
  62.    
  63.     <!--  
  64.    <bean id="passwordEncoder" class="org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder">
  65.        <constructor-arg index="0" value="10"/>
  66.    </bean> -->
  67.    
  68.    
  69. </beans>
  70.  
  71. social config
  72.  
  73. <?xml version="1.0" encoding="UTF-8"?>
  74. <beans xmlns="http://www.springframework.org/schema/beans"
  75.       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  76.       xmlns:context="http://www.springframework.org/schema/context"
  77.       xmlns:twitter="http://www.springframework.org/schema/social/twitter"
  78.       xmlns:social="http://www.springframework.org/schema/social"
  79.       xmlns:facebook="http://www.springframework.org/schema/social/facebook"
  80.       xmlns:aop="http://www.springframework.org/schema/aop"
  81.       xmlns:util="http://www.springframework.org/schema/util"
  82.       xmlns:p="http://www.springframework.org/schema/p"
  83.       xmlns:c="http://www.springframework.org/schema/c"
  84.       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
  85.       http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd
  86.       http://www.springframework.org/schema/social http://www.springframework.org/schema/social/spring-social.xsd
  87.       http://www.springframework.org/schema/social/twitter http://www.springframework.org/schema/social/spring-social-twitter.xsd
  88.       http://www.springframework.org/schema/social/facebook http://www.springframework.org/schema/social/spring-social-facebook.xsd
  89.       http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd
  90.       http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.0.xsd">
  91.        
  92.     <aop:aspectj-autoproxy proxy-target-class="true"/>
  93.        
  94.        
  95.     <facebook:config app-id="${facebook.app.id}" app-secret="${facebook.app.secret}" app-namespace="openreliclbs" />
  96.        
  97.     <bean id="textEncryptor" class="org.springframework.security.crypto.encrypt.Encryptors" factory-method="noOpText" />
  98.    
  99.     <bean id="usersConnectionRepository" class="org.springframework.social.connect.jdbc.JdbcUsersConnectionRepository">
  100.         <constructor-arg ref="dataSource" />
  101.         <constructor-arg ref="connectionFactoryLocator" />
  102.         <constructor-arg ref="textEncryptor" />
  103.     </bean>
  104.  
  105.     <bean id="connectionRepository" factory-method="createConnectionRepository" factory-bean="usersConnectionRepository" scope="request">
  106.         <constructor-arg value=" #{request.getParameter('username')} " />
  107.         <aop:scoped-proxy proxy-target-class="false" />
  108.     </bean>
  109.    
  110.     <bean class="org.springframework.social.connect.web.ConnectController" p:applicationUrl="${application.url}"/>  
  111.    
  112.     <bean id="userIdSource" class="org.springframework.social.security.AuthenticationNameUserIdSource" />
  113.    
  114.     <bean id="socialUsersDetailService" class="com.openrelic.lbs.subscriber.portal.social.security.SimpleSocialUsersDetailService"
  115.         c:_-ref="repositoryBasedUserDetailsService" />
  116.    
  117.     <bean id="socialAuthenticationProvider" class="org.springframework.social.security.SocialAuthenticationProvider"
  118.         c:_0-ref="usersConnectionRepository"
  119.         c:_1-ref="socialUsersDetailService" />
  120.        
  121.     <bean id="psc" class="org.springframework.social.connect.web.ProviderSignInController" autowire="constructor" />       
  122.     <bean id="signInAdapter" class="com.openrelic.lbs.subscriber.portal.social.config.SimpleSignInAdapter" autowire="constructor" />
  123.    
  124.  
  125. </beans>
RAW Paste Data