Skip to content

Commit

Permalink
Revert "Merge pull request #216 from integratedmodelling/IM-457-Merge…
Browse files Browse the repository at this point in the history
…-develop-in-IM-384"

This reverts commit 2da6a10.
  • Loading branch information
kristinaBc3 authored and euskalhenriko committed Dec 17, 2024
1 parent 2da6a10 commit 861ab72
Show file tree
Hide file tree
Showing 140 changed files with 3,003 additions and 3,767 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -470,10 +470,6 @@ public static interface HUB {
* Base URL path for custom properties related to a single user.
*/
public static final String USER_ID_CUSTOM_PROPERTIES = USER_BASE_ID + "/custom-properties";
/**
* URL path for get SPA pages
*/
public static final String UI = "/ui/*";

public static interface PARAMETERS {
/**
Expand Down Expand Up @@ -1283,11 +1279,6 @@ public interface VIEW {
}

}

/**
* URL path for get SPA pages
*/
public static final String UI = "/ui/*";

}

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
*/
public class RemoteUserAuthenticationRequest extends UserAuthenticationRequest {

private String token;
/**
private String token;
/**
* @return the token
*/
public String getToken() {
Expand Down Expand Up @@ -47,6 +47,6 @@ public boolean equals(Object obj) {

@Override
public String toString() {
return "RemoteUserAuthenticationRequest [username=" + getUsername() + ", token="+getToken()+"]";
return "RemoteUserAuthenticationRequest [username=" + getUsername() + ", password=" + getPassword() + ", token="+getToken()+"]";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,26 @@

public class UserAuthenticationRequest {

private String username;

private String username;
private String password;
private boolean remote = false;

public String getUsername() {
return username;
}
public void setUsername(String username) {
public String getUsername() {
return username;
}

public void setUsername(String username) {
this.username = username;
}

public String getPassword() {
return password;
}

public void setPassword(String password) {
this.password = password;
}

public boolean isRemote() {
return remote;
}
Expand All @@ -26,7 +34,7 @@ public void setRemote(boolean jwtToken) {

@Override
public int hashCode() {
return Objects.hash(remote, username);
return Objects.hash(remote, password, username);
}

@Override
Expand All @@ -38,12 +46,12 @@ public boolean equals(Object obj) {
return false;
}
UserAuthenticationRequest other = (UserAuthenticationRequest) obj;
return remote == other.remote && Objects.equals(username, other.username);
return remote == other.remote && Objects.equals(password, other.password) && Objects.equals(username, other.username);
}

@Override
public String toString() {
return "UserAuthenticationRequest [username=" + username + ", remote=" + remote + "]";
return "UserAuthenticationRequest [username=" + username + ", password=" + password + ", remote=" + remote + "]";
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public static String getSessionTokenForDefaultAdministrator(int port) throws URI
URI uri = new URI(baseUrl);
HttpHeaders headers = new HttpHeaders();
UserAuthenticationRequest auth= new UserAuthenticationRequest();

auth.setPassword("password");
auth.setUsername("system");
HttpEntity<?> request = new HttpEntity<>(auth, headers);
RestTemplate restTemplate = new RestTemplate();
Expand Down
16 changes: 1 addition & 15 deletions klab.engine/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -555,21 +555,6 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
<version>${spring-boot.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-oauth2-resource-server</artifactId>
<version>${spring-security.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-oauth2-jose</artifactId>
<version>${spring-security.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-joda</artifactId>
<version>${jackson-version}</version>
</dependency>
<dependency>
<groupId>org.integratedmodelling</groupId>
Expand All @@ -588,6 +573,7 @@
<artifactId>jopt-simple </artifactId>
<version>4.6</version>
</dependency>

<!-- https://mvnrepository.com/artifact/org.eclipse.xtext/org.eclipse.xtext -->
<dependency>
<groupId>org.eclipse.xtext</groupId>
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
*/
@RestController
@CrossOrigin(origins = "*")
//@Secured(Roles.PUBLIC)
@Secured(Roles.PUBLIC)
public class KlabController {

@RequestMapping(value = API.ENGINE.RESOURCE.GET_PROJECT_RESOURCE, method = RequestMethod.GET)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import org.integratedmodelling.klab.api.API;
import org.integratedmodelling.klab.api.PublicAPI;
import org.integratedmodelling.klab.api.auth.IUserIdentity;
import org.integratedmodelling.klab.api.auth.KlabHttpHeaders;
import org.integratedmodelling.klab.api.auth.Roles;
import org.integratedmodelling.klab.api.data.ILocator;
import org.integratedmodelling.klab.api.data.adapters.IResourceAdapter;
Expand Down Expand Up @@ -61,7 +60,6 @@
import org.integratedmodelling.klab.utils.NumberUtils;
import org.springframework.http.MediaType;
import org.springframework.security.access.annotation.Secured;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
Expand All @@ -81,8 +79,8 @@ public class EnginePublicController implements API.PUBLIC {
@RequestMapping(value = CREATE_CONTEXT, method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
public TicketResponse.Ticket contextRequest(@RequestBody ContextRequest request,
@RequestHeader(name = KlabHttpHeaders.KLAB_AUTHORIZATION) String session) {
@RequestHeader(name = "Authorization") String session) {

Session s = Authentication.INSTANCE.getIdentity(session, Session.class);
if (s == null) {
throw new KlabIllegalStateException("create context: invalid session ID");
Expand Down Expand Up @@ -111,7 +109,7 @@ public TicketResponse.Ticket contextRequest(@RequestBody ContextRequest request,
@RequestMapping(value = OBSERVE_IN_CONTEXT, method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
public TicketResponse.Ticket observationRequest(@RequestBody ObservationRequest request,
@RequestHeader(name = KlabHttpHeaders.KLAB_AUTHORIZATION) String session, @PathVariable String context) {
@RequestHeader(name = "Authorization") String session, @PathVariable String context) {

Session s = Authentication.INSTANCE.getIdentity(session, Session.class);

Expand Down Expand Up @@ -145,7 +143,7 @@ public TicketResponse.Ticket observationRequest(@RequestBody ObservationRequest

@RequestMapping(value = SUBMIT_ESTIMATE, method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
public TicketResponse.Ticket submitEstimate(@RequestHeader(name = KlabHttpHeaders.KLAB_AUTHORIZATION) String session,
public TicketResponse.Ticket submitEstimate(@RequestHeader(name = "Authorization") String session,
@PathVariable String estimate) {

Session s = Authentication.INSTANCE.getIdentity(session, Session.class);
Expand All @@ -165,7 +163,6 @@ public TicketResponse.Ticket submitEstimate(@RequestHeader(name = KlabHttpHeader
}

if (est.contextRequest != null) {
//TODO only 1 sessioin parameter
return contextRequest(est.contextRequest, session);
}

Expand All @@ -176,11 +173,11 @@ public TicketResponse.Ticket submitEstimate(@RequestHeader(name = KlabHttpHeader
MediaType.TEXT_PLAIN_VALUE, MediaType.APPLICATION_PDF_VALUE, MediaType.IMAGE_PNG_VALUE, "text/csv", "image/tiff",
"application/vnd.ms-excel", "application/octet-stream",
"application/vnd.openxmlformats-officedocument.wordprocessingml.document"})
public void exportData(@PathVariable String export, @RequestHeader(name = KlabHttpHeaders.KLAB_AUTHORIZATION) String session,
public void exportData(@PathVariable String export, @RequestHeader(name = "Authorization") String session,
@PathVariable String observation, @RequestHeader(name = "Accept") String format,
@RequestParam(required = false) String view, @RequestParam(required = false) String viewport,
@RequestParam(required = false) String locator, HttpServletResponse response) throws IOException {

Session s = Authentication.INSTANCE.getIdentity(session, Session.class);
if (s == null) {
throw new KlabIllegalStateException("observe in context: invalid session ID");
Expand Down Expand Up @@ -388,7 +385,7 @@ private void outputImage(IObservation obs, HttpServletResponse response, Export

@RequestMapping(value = TICKET_INFO, method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
public TicketResponse.Ticket getTicketInfo(@RequestHeader(name = KlabHttpHeaders.KLAB_AUTHORIZATION) String session,
public TicketResponse.Ticket getTicketInfo(@RequestHeader(name = "Authorization") String session,
@PathVariable String ticket) {

Session s = Authentication.INSTANCE.getIdentity(session, Session.class);
Expand Down
Loading

0 comments on commit 861ab72

Please sign in to comment.