code fixes
This commit is contained in:
parent
7fdff4e2df
commit
cfec81b2f7
4 changed files with 5 additions and 14 deletions
|
@ -116,7 +116,7 @@ public class SEBClientConnectionServiceImpl implements SEBClientConnectionServic
|
|||
|
||||
return Result.tryCatch(() -> {
|
||||
|
||||
final SEBClientConfig clientConfig = this.sebClientConfigDAO
|
||||
final SEBClientConfig clientConfig = principal == null ? null : this.sebClientConfigDAO
|
||||
.byClientName(principal.getName())
|
||||
.getOr(null);
|
||||
|
||||
|
|
|
@ -738,7 +738,7 @@ public class ZoomProctoringService implements ExamProctoringService {
|
|||
final String ts = Long.toString(System.currentTimeMillis() - 30000);
|
||||
final String msg = String.format("%s%s%s%d", apiKey, meetingId, ts, status);
|
||||
|
||||
hasher.init(new SecretKeySpec(decryptedSecret.toString().getBytes(), "HmacSHA256"));
|
||||
hasher.init(new SecretKeySpec(Utils.toByteArray(decryptedSecret), "HmacSHA256"));
|
||||
|
||||
final String message = Base64.getEncoder().encodeToString(msg.getBytes());
|
||||
final byte[] hash = hasher.doFinal(message.getBytes());
|
||||
|
|
|
@ -323,7 +323,7 @@ public class ClientConnectionController extends ReadonlyEntityController<ClientC
|
|||
final int result = indicatorValue1.compareTo(indicatorValue2);
|
||||
return (this.clientConnectionComparator.descending) ? -result : result;
|
||||
} catch (final Exception e) {
|
||||
this.clientConnectionComparator.compare(cc1.clientConnection, cc2.clientConnection);
|
||||
return this.clientConnectionComparator.compare(cc1.clientConnection, cc2.clientConnection);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
package ch.ethz.seb.sebserver.webservice.weblayer.api;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.Principal;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
|
@ -299,19 +300,9 @@ public class ExamAPI_V1_Controller {
|
|||
public void ping(final HttpServletRequest request, final HttpServletResponse response) {
|
||||
|
||||
final String connectionToken = request.getHeader(API.EXAM_API_SEB_CONNECTION_TOKEN);
|
||||
//final String timeStampString = request.getParameter(API.EXAM_API_PING_TIMESTAMP);
|
||||
final String pingNumString = request.getParameter(API.EXAM_API_PING_NUMBER);
|
||||
final String instructionConfirm = request.getParameter(API.EXAM_API_PING_INSTRUCTION_CONFIRM);
|
||||
|
||||
// long pingTime;
|
||||
// try {
|
||||
// pingTime = Long.parseLong(timeStampString);
|
||||
// } catch (final Exception e) {
|
||||
// log.error("Invalid ping request: {}", connectionToken);
|
||||
// response.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.value());
|
||||
// return;
|
||||
// }
|
||||
|
||||
final String instruction = this.sebClientConnectionService
|
||||
.notifyPing(
|
||||
connectionToken,
|
||||
|
@ -324,7 +315,7 @@ public class ExamAPI_V1_Controller {
|
|||
} else {
|
||||
try {
|
||||
response.setStatus(HttpStatus.OK.value());
|
||||
response.getOutputStream().write(instruction.getBytes());
|
||||
response.getOutputStream().write(instruction.getBytes(StandardCharsets.UTF_8));
|
||||
} catch (final IOException e) {
|
||||
log.error("Failed to send instruction as response: {}", connectionToken, e);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue