openvidu-server: OPENVIDU_RECORDING_COMPOSED_BASICAUTH

pull/546/head
pabloFuente 2020-09-16 13:50:22 +02:00
parent 08f4b895c0
commit e4ccb6f3bb
4 changed files with 19 additions and 3 deletions

View File

@ -130,6 +130,8 @@ public class OpenviduConfig {
private String openviduRecordingCustomLayout; private String openviduRecordingCustomLayout;
private boolean openviduRecordingComposedBasicauth;
private String openviduRecordingVersion; private String openviduRecordingVersion;
private Integer openviduStreamsVideoMaxRecvBandwidth; private Integer openviduStreamsVideoMaxRecvBandwidth;
@ -246,6 +248,10 @@ public class OpenviduConfig {
return this.openviduRecordingCustomLayout; return this.openviduRecordingCustomLayout;
} }
public boolean isOpenviduRecordingComposedBasicauth() {
return this.openviduRecordingComposedBasicauth;
}
public String getOpenViduRecordingVersion() { public String getOpenViduRecordingVersion() {
return this.openviduRecordingVersion; return this.openviduRecordingVersion;
} }
@ -488,6 +494,7 @@ public class OpenviduConfig {
openviduRecordingPublicAccess = asBoolean("OPENVIDU_RECORDING_PUBLIC_ACCESS"); openviduRecordingPublicAccess = asBoolean("OPENVIDU_RECORDING_PUBLIC_ACCESS");
openviduRecordingAutostopTimeout = asNonNegativeInteger("OPENVIDU_RECORDING_AUTOSTOP_TIMEOUT"); openviduRecordingAutostopTimeout = asNonNegativeInteger("OPENVIDU_RECORDING_AUTOSTOP_TIMEOUT");
openviduRecordingCustomLayout = asFileSystemPath("OPENVIDU_RECORDING_CUSTOM_LAYOUT"); openviduRecordingCustomLayout = asFileSystemPath("OPENVIDU_RECORDING_CUSTOM_LAYOUT");
openviduRecordingComposedBasicauth = asBoolean("OPENVIDU_RECORDING_COMPOSED_BASICAUTH");
openviduRecordingVersion = asNonEmptyString("OPENVIDU_RECORDING_VERSION"); openviduRecordingVersion = asNonEmptyString("OPENVIDU_RECORDING_VERSION");
openviduRecordingComposedUrl = asOptionalURL("OPENVIDU_RECORDING_COMPOSED_URL"); openviduRecordingComposedUrl = asOptionalURL("OPENVIDU_RECORDING_COMPOSED_URL");
checkOpenviduRecordingNotification(); checkOpenviduRecordingNotification();

View File

@ -516,6 +516,8 @@ public class ComposedRecordingService extends RecordingService {
} }
String layout, finalUrl; String layout, finalUrl;
final String basicauth = openviduConfig.isOpenviduRecordingComposedBasicauth() ? ("OPENVIDUAPP:" + secret + "@")
: "";
if (RecordingLayout.CUSTOM.equals(recording.getRecordingLayout())) { if (RecordingLayout.CUSTOM.equals(recording.getRecordingLayout())) {
layout = recording.getCustomLayout(); layout = recording.getCustomLayout();
if (!layout.isEmpty()) { if (!layout.isEmpty()) {
@ -523,8 +525,8 @@ public class ComposedRecordingService extends RecordingService {
layout = layout.endsWith("/") ? layout.substring(0, layout.length() - 1) : layout; layout = layout.endsWith("/") ? layout.substring(0, layout.length() - 1) : layout;
} }
layout += "/index.html"; layout += "/index.html";
finalUrl = (startsWithHttp ? "http" : "https") + "://OPENVIDUAPP:" + secret + "@" + recordingUrl finalUrl = (startsWithHttp ? "http" : "https") + "://" + basicauth + recordingUrl + "/layouts/custom"
+ "/layouts/custom" + layout + "?sessionId=" + recording.getSessionId() + "&secret=" + secret; + layout + "?sessionId=" + recording.getSessionId() + "&secret=" + secret;
} else { } else {
layout = recording.getRecordingLayout().name().toLowerCase().replaceAll("_", "-"); layout = recording.getRecordingLayout().name().toLowerCase().replaceAll("_", "-");
int port = startsWithHttp ? 80 : 443; int port = startsWithHttp ? 80 : 443;
@ -535,7 +537,7 @@ public class ComposedRecordingService extends RecordingService {
} }
String defaultPathForDefaultLayout = recordingComposedUrlDefined ? "" String defaultPathForDefaultLayout = recordingComposedUrlDefined ? ""
: ("/" + openviduConfig.getOpenViduFrontendDefaultPath()); : ("/" + openviduConfig.getOpenViduFrontendDefaultPath());
finalUrl = (startsWithHttp ? "http" : "https") + "://OPENVIDUAPP:" + secret + "@" + recordingUrl finalUrl = (startsWithHttp ? "http" : "https") + "://" + basicauth + recordingUrl
+ defaultPathForDefaultLayout + "/#/layout-" + layout + "/" + recording.getSessionId() + "/" + defaultPathForDefaultLayout + "/#/layout-" + layout + "/" + recording.getSessionId() + "/"
+ secret + "/" + port + "/" + !recording.hasAudio(); + secret + "/" + port + "/" + !recording.hasAudio();
} }

View File

@ -93,6 +93,12 @@
"description": "URL the composed-video recording dockerized Chrome will use to connect to the recording layouts inside OpenVidu Server host. This will affect all video recording layouts (default one BEST_FIT, all CUSTOM layouts). This allows changing the default URL, which is the public URL 'https://DOMAIN_OR_PUBLIC_IP:HTTPS_PORT/', for those cases where OpenVidu Server host does not allow back and forth connections using the public url from inside the host", "description": "URL the composed-video recording dockerized Chrome will use to connect to the recording layouts inside OpenVidu Server host. This will affect all video recording layouts (default one BEST_FIT, all CUSTOM layouts). This allows changing the default URL, which is the public URL 'https://DOMAIN_OR_PUBLIC_IP:HTTPS_PORT/', for those cases where OpenVidu Server host does not allow back and forth connections using the public url from inside the host",
"defaultValue": "" "defaultValue": ""
}, },
{
"name": "OPENVIDU_RECORDING_COMPOSED_BASICAUTH",
"type": "java.lang.Boolean",
"description": "'true' to automatically add Basic Auth credentials to the URL passed to the recording container, false otherwise",
"defaultValue": true
},
{ {
"name": "OPENVIDU_WEBHOOK", "name": "OPENVIDU_WEBHOOK",
"type": "java.lang.Boolean", "type": "java.lang.Boolean",

View File

@ -33,6 +33,7 @@ OPENVIDU_RECORDING_NOTIFICATION=publisher_moderator
OPENVIDU_RECORDING_CUSTOM_LAYOUT=/opt/openvidu/custom-layout OPENVIDU_RECORDING_CUSTOM_LAYOUT=/opt/openvidu/custom-layout
OPENVIDU_RECORDING_AUTOSTOP_TIMEOUT=120 OPENVIDU_RECORDING_AUTOSTOP_TIMEOUT=120
OPENVIDU_RECORDING_COMPOSED_URL= OPENVIDU_RECORDING_COMPOSED_URL=
OPENVIDU_RECORDING_COMPOSED_BASICAUTH=true
OPENVIDU_STREAMS_VIDEO_MAX_RECV_BANDWIDTH=1000 OPENVIDU_STREAMS_VIDEO_MAX_RECV_BANDWIDTH=1000
OPENVIDU_STREAMS_VIDEO_MIN_RECV_BANDWIDTH=300 OPENVIDU_STREAMS_VIDEO_MIN_RECV_BANDWIDTH=300