Advertisement
Guest User

applicationContext

a guest
Nov 26th, 2014
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 1.74 KB | None | 0 0
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <beans:beans xmlns="http://www.springframework.org/schema/security"
  3.     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans"
  4.     xsi:schemaLocation="http://www.springframework.org/schema/beans
  5.                         http://www.springframework.org/schema/beans/spring-beans.xsd
  6.                         http://www.springframework.org/schema/security
  7.                         http://www.springframework.org/schema/security/spring-security-3.2.xsd">
  8.  
  9.     <http auto-config="true">
  10.         <intercept-url pattern="/restrito/admin/*" access="ROLE_ADMIN" />
  11.         <intercept-url pattern="/restrito/basico/*" access="ROLE_BASICO" />
  12.         <intercept-url pattern="/restrito/privilegiado/**"
  13.             access="ROLE_PRIVILEGIADO" />
  14.  
  15.         <form-login login-page="/publico/login.jsf"
  16.             authentication-failure-url="/publico/login.jsf?error=invalido"
  17.             authentication-success-handler-ref="autenticacaoHandler" />
  18.     </http>
  19.  
  20.     <authentication-manager>
  21.         <authentication-provider>
  22.             <jdbc-user-service data-source-ref="dataSource"
  23.                 users-by-username-query="SELECT email, senha, 'true' as enable FROM usuario WHERE email=?"
  24.                 authorities-by-username-query="SELECT senha, permissao FROM usuario WHERE email=?" />
  25.         </authentication-provider>
  26.     </authentication-manager>
  27.    
  28.     <beans:bean id="autenticacaoHandler" class="projetomb.util.AutenticacaoHandler" />
  29.  
  30.     <beans:bean id="dataSource"
  31.         class="org.springframework.jdbc.datasource.DriverManagerDataSource">
  32.         <beans:property name="url"
  33.             value="jdbc:mysql://localhost:3306/meuprojeto" />
  34.         <beans:property name="driverClassName" value="com.mysql.jdbc.Driver" />
  35.         <beans:property name="username" value="root" />
  36.         <beans:property name="password" value="123" />
  37.     </beans:bean>
  38.  
  39. </beans:beans>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement