Compare commits

..
3 Commits
4 changed files with 12 additions and 16 deletions
@@ -22,6 +22,7 @@ import org.springframework.dao.DataAccessException;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
@@ -1,7 +1,8 @@
package com.realnet.FileUpload.Services;
import java.io.File;
import java.io.FileOutputStream;
import java.nio.file.Files;
import java.nio.file.StandardCopyOption;
import java.io.InputStream;
import java.util.ArrayList;
@@ -43,17 +44,11 @@ public class FileuploadService {
}
// reading data
InputStream is = multipartFile.getInputStream();
byte data[] = new byte[is.available()];
is.read(data);
// writing data
FileOutputStream fos = new FileOutputStream(filepath);
fos.write(data);
fos.close();
fos.flush();
// save file
File dest = new File(filepath);
try (InputStream is = multipartFile.getInputStream()) {
Files.copy(is, dest.toPath(), StandardCopyOption.REPLACE_EXISTING);
}
f = true;
} catch (Exception e) {
@@ -114,7 +114,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
web.ignoring().antMatchers("/", "/resources/**", "/static/**", "/public/**", "/webui/**", "/h2-console/**",
"/configuration/**", "/swagger-ui/**", "/swagger-resources/**", "/webjars/**", "/api-docs",
"/api-docs/**", "/v2/api-docs/**", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/**/*.png",
"/**/*.jpg", "/**/*.gif", "/**/*.svg", "/**/*.ico", "/**/*.ttf", "/**/*.woff", "/**/*.otf", "/FileUpload/files/**", "/FileUpload/view/**");
"/**/*.jpg", "/**/*.gif", "/**/*.svg", "/**/*.ico", "/**/*.ttf", "/**/*.woff", "/**/*.otf", "/FileUpload/**");
}
// }
@@ -125,7 +125,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
// Add CORS Filter //http.cors().and().csrf().disable().
.addFilterBefore(new CorsFilter(), ChannelProcessingFilter.class)
// adding backend/token for single container by Azmat 27-08
.authorizeRequests(requests -> requests.antMatchers("/token/**", "/backend/token/**", "/**/backend/token/**", "/FileUpload/files/**", "/FileUpload/view/**").permitAll().antMatchers("/log2/**")
.authorizeRequests(requests -> requests.antMatchers("/token/**", "/backend/token/**", "/**/backend/token/**", "/FileUpload/**").permitAll().antMatchers("/log2/**")
.permitAll().antMatchers("/api/**").permitAll()
// .antMatchers("/SqlworkbenchSqlcont/**").hasRole("ADMIN")
.anyRequest().authenticated())
@@ -62,8 +62,8 @@ spring.mail.properties.mail.smtp.socketFactory.fallback = false
#******* MULTIPART RESOLVER
spring.servlet.multipart.enabled=true
spring.servlet.multipart.max-file-size=100MB
spring.servlet.multipart.max-request-size=100MB
spring.servlet.multipart.max-file-size=500MB
spring.servlet.multipart.max-request-size=500MB
#***************OAUTH2 SOCIAL LOGIN *********
# Social login provider props