Guest User

Untitled

a guest
Jul 17th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.87 KB | None | 0 0
  1. <parent>
  2. <groupId>org.springframework.boot</groupId>
  3. <artifactId>spring-boot-starter-parent</artifactId>
  4. <version>2.0.1.RELEASE</version>
  5. </parent>
  6.  
  7. <properties>
  8. <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  9. <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
  10. <java.version>1.8</java.version>
  11. <start-class>restTeatroproyecto.RestTeatroApplication</start-class>
  12. </properties>
  13.  
  14. <dependencies>
  15. <!-- https://mvnrepository.com/artifact/javax.mail/mail -->
  16. <dependency>
  17. <groupId>javax.mail</groupId>
  18. <artifactId>mail</artifactId>
  19. <version>1.4</version>
  20. </dependency>
  21.  
  22. <dependency>
  23. <groupId>org.springframework</groupId>
  24. <artifactId>spring-web</artifactId>
  25. <version>5.0.5.RELEASE</version>
  26. </dependency>
  27.  
  28.  
  29. <dependency>
  30. <groupId>org.springframework.boot</groupId>
  31. <artifactId>spring-boot-starter-batch</artifactId>
  32. </dependency>
  33. <dependency>
  34. <groupId>org.springframework.boot</groupId>
  35. <artifactId>spring-boot-starter-data-jpa</artifactId>
  36. </dependency>
  37. <dependency>
  38. <groupId>org.springframework.boot</groupId>
  39. <artifactId>spring-boot-starter-jdbc</artifactId>
  40. </dependency>
  41.  
  42. <dependency>
  43. <groupId>org.springframework.boot</groupId>
  44. <artifactId>spring-boot-starter-web</artifactId>
  45. </dependency>
  46.  
  47. <dependency>
  48. <groupId>org.springframework.boot</groupId>
  49. <artifactId>spring-boot-devtools</artifactId>
  50. <scope>runtime</scope>
  51. </dependency>
  52. <dependency>
  53. <groupId>com.microsoft.sqlserver</groupId>
  54. <artifactId>mssql-jdbc</artifactId>
  55. <scope>runtime</scope>
  56. </dependency>
  57. <dependency>
  58. <groupId>org.springframework.boot</groupId>
  59. <artifactId>spring-boot-starter-test</artifactId>
  60. <scope>test</scope>
  61. </dependency>
  62. <!-- <dependency> -->
  63. <!-- <groupId>org.springframework.boot</groupId> -->
  64. <!-- <artifactId>spring-boot-starter-data-jpa</artifactId> -->
  65. <!-- <exclusions> -->
  66. <!-- <exclusion> -->
  67. <!-- <groupId>org.hibernate</groupId> -->
  68. <!-- <artifactId>hibernate-entitymanager</artifactId> -->
  69. <!-- </exclusion> -->
  70. <!-- <exclusion> -->
  71. <!-- <groupId>org.hibernate</groupId> -->
  72. <!-- <artifactId>hibernate-core</artifactId> -->
  73. <!-- </exclusion> -->
  74. <!-- </exclusions> -->
  75. <!-- </dependency> -->
  76. <dependency>
  77. <groupId>org.hibernate</groupId>
  78. <artifactId>hibernate-core</artifactId>
  79. </dependency>
  80. <dependency>
  81. <groupId>io.jsonwebtoken</groupId>
  82. <artifactId>jjwt</artifactId>
  83. <version>0.9.0</version>
  84. </dependency>
  85. <!-- <dependency> -->
  86. <!-- <groupId>javax.json</groupId> -->
  87. <!-- <artifactId>javax.json-api</artifactId> -->
  88. <!-- <version>1.1.2</version> -->
  89. <!-- </dependency> -->
  90. <!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-security -->
  91. <dependency>
  92. <groupId>org.springframework.boot</groupId>
  93. <artifactId>spring-boot-starter-security</artifactId>
  94. <version>2.0.0.RELEASE</version>
  95. </dependency>
  96.  
  97. <!-- https://mvnrepository.com/artifact/org.springframework.security/spring-security-core -->
  98. <dependency>
  99. <groupId>org.springframework.security</groupId>
  100. <artifactId>spring-security-core</artifactId>
  101. <version>5.0.3.RELEASE</version>
  102. </dependency>
  103.  
  104. <!-- https://mvnrepository.com/artifact/org.springframework.security/spring-security-web -->
  105. <dependency>
  106. <groupId>org.springframework.security</groupId>
  107. <artifactId>spring-security-web</artifactId>
  108. <version>5.0.3.RELEASE</version>
  109. </dependency>
  110.  
  111. <!-- https://mvnrepository.com/artifact/org.springframework.security/spring-security-config -->
  112. <dependency>
  113. <groupId>org.springframework.security</groupId>
  114. <artifactId>spring-security-config</artifactId>
  115. <version>5.0.3.RELEASE</version>
  116. </dependency>
  117.  
  118. <dependency>
  119. <groupId>commons-httpclient</groupId>
  120. <artifactId>commons-httpclient</artifactId>
  121. <version>3.1</version>
  122. </dependency>
  123. <dependency>
  124. <groupId>org.eclipse.jetty.aggregate</groupId>
  125. <artifactId>jetty-all</artifactId>
  126. <version>9.2.13.v20150730</version>
  127. </dependency>
  128. <dependency>
  129. <groupId>org.springframework.boot</groupId>
  130. <artifactId>spring-boot-starter-thymeleaf</artifactId>
  131. <version>1.4.0.RELEASE</version>
  132. </dependency>
  133. <dependency>
  134. <groupId>io.jsonwebtoken</groupId>
  135. <artifactId>jjwt</artifactId>
  136. <version>0.9.0</version>
  137. </dependency>
  138. <dependency>
  139. <groupId>org.jsoup</groupId>
  140. <artifactId>jsoup</artifactId>
  141. <version>1.8.3</version>
  142. </dependency>
  143. <!-- https://mvnrepository.com/artifact/com.google.code.gson/gson -->
  144. <dependency>
  145. <groupId>com.google.code.gson</groupId>
  146. <artifactId>gson</artifactId>
  147. <version>2.8.2</version>
  148. </dependency>
  149. <!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.jaxrs/jackson-jaxrs-json-provider -->
  150. <dependency>
  151. <groupId>com.fasterxml.jackson.jaxrs</groupId>
  152. <artifactId>jackson-jaxrs-json-provider</artifactId>
  153. <version>2.9.0</version>
  154. </dependency>
  155.  
  156. <!-- https://mvnrepository.com/artifact/net.sf.jasperreports/jasperreports -->
  157. <dependency>
  158. <groupId>net.sf.jasperreports</groupId>
  159. <artifactId>jasperreports</artifactId>
  160. <version>6.1.0</version>
  161. </dependency>
  162. <!-- https://mvnrepository.com/artifact/net.sf.barcode4j/barcode4j -->
  163. <dependency>
  164. <groupId>net.sf.barcode4j</groupId>
  165. <artifactId>barcode4j</artifactId>
  166. <version>2.0</version>
  167. </dependency>
  168.  
  169. <!-- https://mvnrepository.com/artifact/org.apache.xmlgraphics/batik-bridge -->
  170. <dependency>
  171. <groupId>org.apache.xmlgraphics</groupId>
  172. <artifactId>batik-bridge</artifactId>
  173. <version>1.6.1</version>
  174. </dependency>
  175. <!-- https://mvnrepository.com/artifact/xerces/xercesImpl -->
  176. <dependency>
  177. <groupId>xerces</groupId>
  178. <artifactId>xercesImpl</artifactId>
  179. <version>2.9.0</version>
  180. </dependency>
  181.  
  182.  
  183. <!-- POI for jasper reports demo -->
  184. <dependency>
  185. <groupId>org.apache.poi</groupId>
  186. <artifactId>poi</artifactId>
  187. <version>3.7</version>
  188. </dependency>
  189.  
  190. <dependency>
  191. <groupId>org.springframework.boot</groupId>
  192. <artifactId>spring-boot-starter-thymeleaf</artifactId>
  193. </dependency>
  194.  
  195. <!-- marked the embedded servlet container as provided -->
  196. <dependency>
  197. <groupId>org.springframework.boot</groupId>
  198. <artifactId>spring-boot-starter-tomcat</artifactId>
  199. <scope>provided</scope>
  200. </dependency>
  201.  
  202. <dependency>
  203. <groupId>org.springframework.boot</groupId>
  204. <artifactId>spring-boot-starter-jetty</artifactId>
  205. </dependency>
  206.  
  207. </dependencies>
  208.  
  209. <build>
  210. <plugins>
  211. <plugin>
  212. <groupId>org.springframework.boot</groupId>
  213. <artifactId>spring-boot-maven-plugin</artifactId>
  214. <version>1.4.2.RELEASE</version>
  215. <executions>
  216. <execution>
  217. <goals>
  218. <goal>repackage</goal>
  219. </goals>
  220. </execution>
  221. </executions>
  222. </plugin>
  223. <plugin>
  224. <groupId>org.apache.maven.plugins</groupId>
  225. <artifactId>maven-war-plugin</artifactId>
  226. <configuration>
  227. <packagingExcludes>WEB-INF/lib/websocket-*.jar</packagingExcludes>
  228. </configuration>
  229. </plugin>
  230. </plugins>
  231. </build>
  232.  
  233. @Configuration
  234. @Order(99)
  235. public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
  236. @Autowired
  237. private IUsuarioService usuarioService;
  238.  
  239. // @Autowired
  240. // public WebSecurityConfig() {
  241. // super(true);
  242. // }
  243. //
  244. @Override
  245. protected void configure(HttpSecurity http) throws Exception {
  246. http.csrf().disable().authorizeRequests().antMatchers(HttpMethod.OPTIONS, "/**").permitAll()// allow CORS option
  247. // calls
  248. .antMatchers(HttpMethod.POST, "/api/login").permitAll().antMatchers(HttpMethod.POST, "/login")
  249.  
  250. .permitAll().anyRequest().authenticated().and()
  251. // We filter the api/login requests
  252. .addFilterBefore(new JWTLoginFilter("/login", authenticationManager()),
  253. UsernamePasswordAuthenticationFilter.class)
  254. // And filter other requests to check the presence of JWT in header
  255. .addFilterBefore(new JWTAuthenticationFilter(), UsernamePasswordAuthenticationFilter.class)
  256. .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS);
  257.  
  258. }
  259. }
Add Comment
Please, Sign In to add comment