mirror of https://github.com/OpenVidu/openvidu.git
openvidu-server: common identifiers format
parent
68e88f21db
commit
2cbdcb9251
|
@ -368,12 +368,14 @@ public abstract class SessionManager {
|
||||||
public Participant newParticipant(String sessionId, String participantPrivatetId, Token token,
|
public Participant newParticipant(String sessionId, String participantPrivatetId, Token token,
|
||||||
String clientMetadata, GeoLocation location, String platform, String finalUserId) {
|
String clientMetadata, GeoLocation location, String platform, String finalUserId) {
|
||||||
if (this.sessionidParticipantpublicidParticipant.get(sessionId) != null) {
|
if (this.sessionidParticipantpublicidParticipant.get(sessionId) != null) {
|
||||||
String participantPublicId = RandomStringUtils.randomAlphanumeric(16).toLowerCase();
|
String participantPublicId = "con_" + RandomStringUtils.randomAlphabetic(1).toUpperCase()
|
||||||
|
+ RandomStringUtils.randomAlphanumeric(9);
|
||||||
Participant p = new Participant(finalUserId, participantPrivatetId, participantPublicId, sessionId, token,
|
Participant p = new Participant(finalUserId, participantPrivatetId, participantPublicId, sessionId, token,
|
||||||
clientMetadata, location, platform, EndpointType.WEBRTC_ENDPOINT, null);
|
clientMetadata, location, platform, EndpointType.WEBRTC_ENDPOINT, null);
|
||||||
while (this.sessionidParticipantpublicidParticipant.get(sessionId).putIfAbsent(participantPublicId,
|
while (this.sessionidParticipantpublicidParticipant.get(sessionId).putIfAbsent(participantPublicId,
|
||||||
p) != null) {
|
p) != null) {
|
||||||
participantPublicId = RandomStringUtils.randomAlphanumeric(16).toLowerCase();
|
participantPublicId = "con_" + RandomStringUtils.randomAlphabetic(1).toUpperCase()
|
||||||
|
+ RandomStringUtils.randomAlphanumeric(9);
|
||||||
p.setParticipantPublicId(participantPublicId);
|
p.setParticipantPublicId(participantPublicId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,8 @@ public class TokenGeneratorDefault implements TokenGenerator {
|
||||||
KurentoTokenOptions kurentoTokenOptions) {
|
KurentoTokenOptions kurentoTokenOptions) {
|
||||||
String token = OpenViduServer.wsUrl;
|
String token = OpenViduServer.wsUrl;
|
||||||
token += "?sessionId=" + sessionId;
|
token += "?sessionId=" + sessionId;
|
||||||
token += "&token=" + RandomStringUtils.randomAlphanumeric(16).toLowerCase();
|
token += "&token=" + "tok_" + RandomStringUtils.randomAlphabetic(1).toUpperCase()
|
||||||
|
+ RandomStringUtils.randomAlphanumeric(15);
|
||||||
token += "&role=" + role.name();
|
token += "&role=" + role.name();
|
||||||
token += "&version=" + openviduConfig.getOpenViduServerVersion();
|
token += "&version=" + openviduConfig.getOpenViduServerVersion();
|
||||||
TurnCredentials turnCredentials = null;
|
TurnCredentials turnCredentials = null;
|
||||||
|
|
|
@ -100,9 +100,10 @@ public class KurentoParticipant extends Participant {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void createPublishingEndpoint(MediaOptions mediaOptions) {
|
public void createPublishingEndpoint(MediaOptions mediaOptions) {
|
||||||
final String publisherStreamId = this.getParticipantPublicId() + "_"
|
String type = mediaOptions.hasVideo() ? mediaOptions.getTypeOfVideo() : "MICRO";
|
||||||
+ (mediaOptions.hasVideo() ? mediaOptions.getTypeOfVideo() : "MICRO") + "_"
|
final String publisherStreamId = "str_" + type.substring(0, Math.min(type.length(), 3)) + "_"
|
||||||
+ RandomStringUtils.random(5, true, false).toUpperCase();
|
+ RandomStringUtils.randomAlphabetic(1).toUpperCase() + RandomStringUtils.randomAlphanumeric(3) + "_"
|
||||||
|
+ this.getParticipantPublicId().substring(4, this.getParticipantPublicId().length());
|
||||||
publisher.setStreamId(publisherStreamId);
|
publisher.setStreamId(publisherStreamId);
|
||||||
publisher.setEndpointName(publisherStreamId);
|
publisher.setEndpointName(publisherStreamId);
|
||||||
publisher.setMediaOptions(mediaOptions);
|
publisher.setMediaOptions(mediaOptions);
|
||||||
|
|
|
@ -899,13 +899,14 @@ public class KurentoSessionManager extends SessionManager {
|
||||||
location = null;
|
location = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
final String rtspConnectionId = kMediaOptions.getTypeOfVideo() + "-" + protocol + "-"
|
final String rtspConnectionId = "ipc_" + kMediaOptions.getTypeOfVideo() + "-" + protocol + "-"
|
||||||
+ RandomStringUtils.randomAlphanumeric(4).toLowerCase() + "-" + url.getAuthority()
|
+ RandomStringUtils.randomAlphanumeric(4).toLowerCase() + "-" + url.getAuthority()
|
||||||
+ url.getPath().replaceAll("/", "-").replaceAll("_", "-");
|
+ url.getPath().replaceAll("/", "-").replaceAll("_", "-");
|
||||||
|
|
||||||
// Store a "fake" participant for the IpCam connection
|
// Store a "fake" participant for the IpCam connection
|
||||||
this.newInsecureParticipant(rtspConnectionId);
|
this.newInsecureParticipant(rtspConnectionId);
|
||||||
String token = RandomStringUtils.randomAlphanumeric(16).toLowerCase();
|
String token = "tok_" + RandomStringUtils.randomAlphabetic(1).toUpperCase()
|
||||||
|
+ RandomStringUtils.randomAlphanumeric(15);
|
||||||
Token tokenObj = null;
|
Token tokenObj = null;
|
||||||
if (this.isTokenValidInSession(token, sessionId, rtspConnectionId, serverMetadata)) {
|
if (this.isTokenValidInSession(token, sessionId, rtspConnectionId, serverMetadata)) {
|
||||||
tokenObj = this.consumeToken(sessionId, rtspConnectionId, token);
|
tokenObj = this.consumeToken(sessionId, rtspConnectionId, token);
|
||||||
|
|
|
@ -60,7 +60,8 @@ public class FixedOneKmsManager extends KmsManager {
|
||||||
try {
|
try {
|
||||||
List<KmsProperties> kmsProps = new ArrayList<>();
|
List<KmsProperties> kmsProps = new ArrayList<>();
|
||||||
for (String kmsUri : this.openviduConfig.getKmsUris()) {
|
for (String kmsUri : this.openviduConfig.getKmsUris()) {
|
||||||
String kmsId = "kms-" + RandomStringUtils.randomAlphanumeric(6).toUpperCase();
|
String kmsId = "kms_" + RandomStringUtils.randomAlphabetic(1).toUpperCase()
|
||||||
|
+ RandomStringUtils.randomAlphanumeric(7);
|
||||||
kmsProps.add(new KmsProperties(kmsId, kmsUri));
|
kmsProps.add(new KmsProperties(kmsId, kmsUri));
|
||||||
}
|
}
|
||||||
this.initializeKurentoClients(kmsProps, true, false);
|
this.initializeKurentoClients(kmsProps, true, false);
|
||||||
|
|
|
@ -159,7 +159,8 @@ public class SessionRestController {
|
||||||
}
|
}
|
||||||
sessionId = customSessionId;
|
sessionId = customSessionId;
|
||||||
} else {
|
} else {
|
||||||
sessionId = RandomStringUtils.randomAlphanumeric(16).toLowerCase();
|
sessionId = "ses_" + RandomStringUtils.randomAlphabetic(1).toUpperCase()
|
||||||
|
+ RandomStringUtils.randomAlphanumeric(9);
|
||||||
}
|
}
|
||||||
|
|
||||||
Session sessionNotActive = sessionManager.storeSessionNotActive(sessionId, sessionProperties);
|
Session sessionNotActive = sessionManager.storeSessionNotActive(sessionId, sessionProperties);
|
||||||
|
|
|
@ -231,7 +231,8 @@ public class RpcHandler extends DefaultJsonRpcHandler<JsonObject> {
|
||||||
|
|
||||||
if (openviduConfig.isOpenViduSecret(secret)) {
|
if (openviduConfig.isOpenViduSecret(secret)) {
|
||||||
sessionManager.newInsecureParticipant(participantPrivatetId);
|
sessionManager.newInsecureParticipant(participantPrivatetId);
|
||||||
token = RandomStringUtils.randomAlphanumeric(16).toLowerCase();
|
token = "tok_" + RandomStringUtils.randomAlphabetic(1).toUpperCase()
|
||||||
|
+ RandomStringUtils.randomAlphanumeric(15);
|
||||||
if (recorder) {
|
if (recorder) {
|
||||||
generateRecorderParticipant = true;
|
generateRecorderParticipant = true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue