Skip to content

Commit

Permalink
removed authentication for ws ontologyUpload and fixed ajax request h…
Browse files Browse the repository at this point in the history
…eaders
  • Loading branch information
gcpdev committed Jan 6, 2018
1 parent cf47a6e commit 3577c35
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
9 changes: 6 additions & 3 deletions guidelines/web/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,19 +187,22 @@ function ($) {
});

let startUpload = function (ontology, shacl) {
$("#upload-progress").show("slow");
//$("#upload-progress").show("slow");
//let file = files[0];
let formData = new FormData();
formData.append("ontology", ontology);
formData.append("shacltest", shacl);
formData.append("format", "text/turtle");

$.ajax({
url: 'http://localhost:8080/ws/users/ontologyUpload',
method: 'POST',
type: 'POST',
data: formData,
contentType: 'text/turtle',
accepts: { "*": "text/turtle" },
contentType: false,
processData: false,
cache: false,
xhr: function () {
let xhr = new window.XMLHttpRequest();
xhr.upload.addEventListener("progress",
Expand Down Expand Up @@ -281,7 +284,7 @@ jQuery(function ($) {

SHACL_tests_group = `
gdl-shape: ${groups[index].shape}
gdl-shape:${groups[index].shape}
a sh:Shape;
`;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ public class SecurityConstants {
public static final String HEADER_STRING = "Authorization";
public static final String SIGN_UP_URL = "/ws/users/sign-up";
public static final String PUBLIC_ONTOLOGY = "/ws/ontology";
public static final String ONTOLOGY_UPLOAD = "/ws/users/ontologyUpload";
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
import org.springframework.context.annotation.Bean;

import static org.dbpedia.ontologytracker.webservice.authapi.SecurityConstants.ONTOLOGY_UPLOAD;
import static org.dbpedia.ontologytracker.webservice.authapi.SecurityConstants.PUBLIC_ONTOLOGY;
import static org.dbpedia.ontologytracker.webservice.authapi.SecurityConstants.SIGN_UP_URL;

Expand All @@ -32,6 +33,7 @@ protected void configure(HttpSecurity http) throws Exception {
http.cors().and().csrf().disable().authorizeRequests()
.antMatchers(HttpMethod.POST, SIGN_UP_URL).permitAll()
.antMatchers(HttpMethod.POST, PUBLIC_ONTOLOGY).permitAll()
.antMatchers(HttpMethod.POST, ONTOLOGY_UPLOAD).permitAll()
.anyRequest().authenticated()
.and()
.addFilter(new JWTAuthenticationFilter(authenticationManager()))
Expand Down

0 comments on commit 3577c35

Please sign in to comment.