Security system improved: no openvidu.security env variable needed
This commit is contained in:
parent
0dc031c0c8
commit
10d5b69057
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -30,6 +30,8 @@ export class OpenViduInternal {
|
||||
private camera: Stream;
|
||||
private remoteStreams: Stream[] = [];
|
||||
|
||||
private secret: string;
|
||||
|
||||
constructor() { };
|
||||
|
||||
|
||||
@ -103,6 +105,14 @@ export class OpenViduInternal {
|
||||
this.wsUri = wsUri;
|
||||
}
|
||||
|
||||
getSecret() {
|
||||
return this.secret;
|
||||
}
|
||||
|
||||
setSecret(secret: string) {
|
||||
this.secret = secret;
|
||||
}
|
||||
|
||||
getOpenViduServerURL() {
|
||||
return 'https://' + this.wsUri.split("wss://")[1].split("/room")[0];
|
||||
}
|
||||
|
||||
@ -3,6 +3,8 @@ import { OpenViduInternal } from './OpenViduInternal';
|
||||
import { Connection, ConnectionOptions } from './Connection';
|
||||
import EventEmitter = require('wolfy87-eventemitter');
|
||||
|
||||
const SECRET_PARAM = '?secret=';
|
||||
|
||||
export interface SessionOptions {
|
||||
sessionId: string;
|
||||
participantId: string;
|
||||
@ -15,6 +17,7 @@ export interface SessionOptions {
|
||||
export class SessionInternal {
|
||||
|
||||
private id: string;
|
||||
private sessionId: string;
|
||||
private ee = new EventEmitter();
|
||||
private streams = {};
|
||||
private participants = {};
|
||||
@ -24,27 +27,48 @@ export class SessionInternal {
|
||||
private subscribeToStreams: boolean;
|
||||
private updateSpeakerInterval: number;
|
||||
public thresholdSpeaker: number;
|
||||
private options: SessionOptions
|
||||
private options: SessionOptions;
|
||||
|
||||
constructor(private openVidu: OpenViduInternal, private sessionId: string) {
|
||||
constructor(private openVidu: OpenViduInternal, sessionId: string) {
|
||||
this.sessionId = this.getUrlWithoutSecret(sessionId);
|
||||
this.localParticipant = new Connection(this.openVidu, true, this);
|
||||
if (!this.openVidu.getWsUri()) {
|
||||
this.openVidu.setWsUri(this.checkNgrokUri(sessionId));
|
||||
this.processOpenViduUrl(sessionId);
|
||||
}
|
||||
}
|
||||
|
||||
checkNgrokUri(sessionId: string): string {
|
||||
sessionId = sessionId.substring(0, sessionId.lastIndexOf('/')) + '/room';
|
||||
if (sessionId.indexOf(".ngrok.io") !== -1) {
|
||||
private processOpenViduUrl(url: string) {
|
||||
this.openVidu.setSecret(this.getSecretFromUrl(url));
|
||||
this.openVidu.setWsUri(this.getFinalUrl(url));
|
||||
}
|
||||
|
||||
private getSecretFromUrl(url: string): string {
|
||||
let secret = '';
|
||||
if (url.indexOf(SECRET_PARAM) !== -1) {
|
||||
secret = url.substring(url.lastIndexOf(SECRET_PARAM) + SECRET_PARAM.length, url.length);
|
||||
}
|
||||
return secret;
|
||||
}
|
||||
|
||||
private getUrlWithoutSecret(url: string): string {
|
||||
if (url.indexOf(SECRET_PARAM) !== -1) {
|
||||
url = url.substring(0, url.lastIndexOf(SECRET_PARAM));
|
||||
}
|
||||
return url;
|
||||
}
|
||||
|
||||
private getFinalUrl(url: string): string {
|
||||
url = this.getUrlWithoutSecret(url).substring(0, url.lastIndexOf('/')) + '/room';
|
||||
if (url.indexOf(".ngrok.io") !== -1) {
|
||||
// OpenVidu server URL referes to a ngrok IP: secure wss protocol and delete port of URL
|
||||
sessionId = sessionId.replace("ws://", "wss://");
|
||||
url = url.replace("ws://", "wss://");
|
||||
let regex = /\.ngrok\.io:\d+/;
|
||||
sessionId = sessionId.replace(regex, ".ngrok.io");
|
||||
} else if ((sessionId.indexOf("localhost") !== -1) || (sessionId.indexOf("127.0.0.1") != -1)) {
|
||||
url = url.replace(regex, ".ngrok.io");
|
||||
} else if ((url.indexOf("localhost") !== -1) || (url.indexOf("127.0.0.1") != -1)) {
|
||||
// OpenVidu server URL referes to localhost IP
|
||||
|
||||
}
|
||||
return sessionId;
|
||||
return url;
|
||||
}
|
||||
|
||||
|
||||
@ -62,6 +86,7 @@ export class SessionInternal {
|
||||
token: token,
|
||||
session: this.sessionId,
|
||||
metadata: this.options.metadata,
|
||||
secret: this.openVidu.getSecret(),
|
||||
dataChannels: false
|
||||
}
|
||||
|
||||
|
||||
@ -642,7 +642,7 @@ export class Stream {
|
||||
|
||||
this.elements.forEach(e => disposeElement(e));
|
||||
|
||||
this.videoElements.forEach(ve => disposeElement(ve));
|
||||
//this.videoElements.forEach(ve => disposeElement(ve.video));
|
||||
|
||||
disposeElement("progress-" + this.getId());
|
||||
|
||||
|
||||
@ -37,6 +37,8 @@ public class ProtocolElements {
|
||||
public static final String JOINROOM_TOKEN_PARAM = "token";
|
||||
public static final String JOINROOM_ROOM_PARAM = "session";
|
||||
public static final String JOINROOM_METADATA_PARAM = "metadata";
|
||||
public static final String JOINROOM_SECRET_PARAM = "secret";
|
||||
|
||||
public static final String JOINROOM_DATACHANNELS_PARAM = "dataChannels";
|
||||
public static final String JOINROOM_PEERID_PARAM = "id";
|
||||
public static final String JOINROOM_PEERSTREAMS_PARAM = "streams";
|
||||
|
||||
@ -21,7 +21,7 @@ export class Session {
|
||||
public getSessionId(callback: Function) {
|
||||
|
||||
if (this.sessionId) {
|
||||
return this.sessionId;
|
||||
callback(this.sessionId);
|
||||
}
|
||||
|
||||
let options = {
|
||||
|
||||
@ -2,34 +2,40 @@ import { NgModule } from '@angular/core';
|
||||
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import {
|
||||
MdButtonModule,
|
||||
MdIconModule,
|
||||
MdCheckboxModule,
|
||||
MdCardModule,
|
||||
MdInputModule,
|
||||
MdProgressSpinnerModule,
|
||||
MdTooltipModule,
|
||||
MdDialogModule
|
||||
MdDialogModule,
|
||||
MdSlideToggleModule
|
||||
} from '@angular/material';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
BrowserAnimationsModule,
|
||||
MdButtonModule,
|
||||
MdIconModule,
|
||||
MdCheckboxModule,
|
||||
MdCardModule,
|
||||
MdInputModule,
|
||||
MdProgressSpinnerModule,
|
||||
MdTooltipModule,
|
||||
MdDialogModule
|
||||
MdDialogModule,
|
||||
MdSlideToggleModule
|
||||
],
|
||||
exports: [
|
||||
BrowserAnimationsModule,
|
||||
MdButtonModule,
|
||||
MdIconModule,
|
||||
MdCheckboxModule,
|
||||
MdCardModule,
|
||||
MdInputModule,
|
||||
MdProgressSpinnerModule,
|
||||
MdTooltipModule,
|
||||
MdDialogModule
|
||||
MdDialogModule,
|
||||
MdSlideToggleModule
|
||||
],
|
||||
})
|
||||
export class AppMaterialModule { }
|
||||
|
||||
@ -4,6 +4,7 @@ import { NgModule } from '@angular/core';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { HttpModule } from '@angular/http';
|
||||
import { RouterModule } from '@angular/router';
|
||||
import 'hammerjs';
|
||||
|
||||
import { routing } from './app.routing';
|
||||
import { AppMaterialModule } from 'app/app.material.module';
|
||||
|
||||
@ -2,14 +2,18 @@
|
||||
|
||||
<div fxLayout="column" fxFlex="66%" fxFlexOrder="1" fxFlexOrder.xs="2">
|
||||
<md-card id="log">
|
||||
<md-card-title>Server events</md-card-title>
|
||||
<md-card-title>Server events
|
||||
<md-slide-toggle title="Lock Scroll" [(ngModel)]="lockScroll" style="float: right; margin-left: auto;">
|
||||
<md-icon>lock_outline</md-icon>
|
||||
</md-slide-toggle>
|
||||
</md-card-title>
|
||||
<md-divider></md-divider>
|
||||
<md-card-content #scrollMe id="log-content">
|
||||
<md-list>
|
||||
<md-list-item *ngFor="let i of info">
|
||||
<ul>
|
||||
<li *ngFor="let i of info">
|
||||
<p>{{i}}</p>
|
||||
</md-list-item>
|
||||
</md-list>
|
||||
</li>
|
||||
</ul>
|
||||
</md-card-content>
|
||||
</md-card>
|
||||
</div>
|
||||
@ -17,11 +21,12 @@
|
||||
<div fxLayout="column" fxFlex="33%" fxFlexOrder="2" fxFlexOrder.xs="1">
|
||||
<md-card id="video-loop">
|
||||
<md-card-title>Test the connection
|
||||
<button [class]="testStatus == 'DISCONNECTED' ? 'blue' : (testStatus == 'PLAYING' ? 'yellow' : 'disabled')" md-raised-button (click)="toggleTestVideo()" [disabled]="testStatus==='CONNECTING' || testStatus==='CONNECTED'">{{testButton}}</button></md-card-title>
|
||||
<button [class]="testStatus == 'DISCONNECTED' ? 'blue' : (testStatus == 'PLAYING' ? 'yellow' : 'disabled')" md-raised-button
|
||||
(click)="toggleTestVideo()" [disabled]="testStatus==='CONNECTING' || testStatus==='CONNECTED'">{{testButton}}</button></md-card-title>
|
||||
<md-card-content #scrollMe id="log-content">
|
||||
<div id="mirrored-video">
|
||||
<div *ngIf="showSpinner" id="loader">
|
||||
<div class="loader-1 center"><span></span></div>
|
||||
<div class="loader-1 center"><span></span></div>
|
||||
</div>
|
||||
<!--<md-spinner *ngIf="showSpinner" [color]="color"></md-spinner>-->
|
||||
<div *ngIf="session" id="tick-div">
|
||||
|
||||
@ -1,9 +1,8 @@
|
||||
import { Component, OnInit, AfterViewChecked, ViewChild, ElementRef, HostListener, OnDestroy } from '@angular/core';
|
||||
import { Component, OnInit, ViewChild, ElementRef, HostListener, OnDestroy } from '@angular/core';
|
||||
import { MdDialog, MdDialogRef } from '@angular/material';
|
||||
import { Subscription } from 'rxjs/Subscription';
|
||||
|
||||
import { InfoService } from '../../services/info.service';
|
||||
import { CredentialsService } from '../../services/credentials.service';
|
||||
|
||||
import { OpenVidu, Session } from 'openvidu-browser';
|
||||
import { CredentialsDialogComponent } from './credentials-dialog.component';
|
||||
@ -15,9 +14,10 @@ declare const $;
|
||||
templateUrl: './dashboard.component.html',
|
||||
styleUrls: ['./dashboard.component.css'],
|
||||
})
|
||||
export class DashboardComponent implements OnInit, OnDestroy, AfterViewChecked {
|
||||
export class DashboardComponent implements OnInit, OnDestroy {
|
||||
|
||||
@ViewChild('scrollMe') private myScrollContainer: ElementRef;
|
||||
lockScroll = false;
|
||||
|
||||
infoSubscription: Subscription;
|
||||
info = [];
|
||||
@ -29,12 +29,12 @@ export class DashboardComponent implements OnInit, OnDestroy, AfterViewChecked {
|
||||
tickClass = 'trigger';
|
||||
showSpinner = false;
|
||||
|
||||
constructor(private infoService: InfoService, private credentialsService: CredentialsService, public dialog: MdDialog) {
|
||||
|
||||
constructor(private infoService: InfoService, public dialog: MdDialog) {
|
||||
// Subscription to info updated event raised by InfoService
|
||||
this.infoSubscription = this.infoService.newInfo$.subscribe(
|
||||
info => {
|
||||
this.info.push(info);
|
||||
this.scrollToBottom();
|
||||
});
|
||||
}
|
||||
|
||||
@ -57,10 +57,6 @@ export class DashboardComponent implements OnInit, OnDestroy, AfterViewChecked {
|
||||
}
|
||||
}
|
||||
|
||||
ngAfterViewChecked() {
|
||||
this.scrollToBottom();
|
||||
}
|
||||
|
||||
toggleTestVideo() {
|
||||
if (!this.session) {
|
||||
this.testVideo();
|
||||
@ -70,11 +66,19 @@ export class DashboardComponent implements OnInit, OnDestroy, AfterViewChecked {
|
||||
}
|
||||
|
||||
testVideo() {
|
||||
let OV = new OpenVidu();
|
||||
this.connectToSession(OV, 'wss://' + location.hostname + ':8443/testSession', 'token');
|
||||
let dialogRef: MdDialogRef<CredentialsDialogComponent>;
|
||||
dialogRef = this.dialog.open(CredentialsDialogComponent);
|
||||
dialogRef.componentInstance.myReference = dialogRef;
|
||||
|
||||
dialogRef.afterClosed().subscribe(secret => {
|
||||
if (secret) {
|
||||
this.connectToSession('wss://' + location.hostname + ':8443/testSession?secret=' + secret);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
connectToSession(OV: OpenVidu, mySessionId: string, myToken: string) {
|
||||
connectToSession(mySessionId: string) {
|
||||
let OV = new OpenVidu();
|
||||
this.session = OV.initSession(mySessionId);
|
||||
|
||||
this.session.on('streamCreated', (event) => {
|
||||
@ -84,7 +88,7 @@ export class DashboardComponent implements OnInit, OnDestroy, AfterViewChecked {
|
||||
this.testStatus = 'CONNECTING';
|
||||
this.testButton = 'Testing...';
|
||||
|
||||
this.session.connect(myToken, (error) => {
|
||||
this.session.connect('token', (error) => {
|
||||
if (!error) {
|
||||
|
||||
this.testStatus = 'CONNECTED';
|
||||
@ -118,18 +122,7 @@ export class DashboardComponent implements OnInit, OnDestroy, AfterViewChecked {
|
||||
|
||||
dialogRef.afterClosed().subscribe(secret => {
|
||||
if (secret) {
|
||||
this.credentialsService.getSessionId(secret).subscribe(
|
||||
sessionId => {
|
||||
this.credentialsService.getToken(sessionId.id, secret).subscribe(
|
||||
token => {
|
||||
this.connectToSession(OV, sessionId.id, token.token);
|
||||
}
|
||||
)
|
||||
},
|
||||
err => {
|
||||
console.log(err);
|
||||
}
|
||||
);
|
||||
this.connectToSession('wss://' + location.hostname + ':8443/testSession?secret=' + secret);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
@ -145,13 +138,16 @@ export class DashboardComponent implements OnInit, OnDestroy, AfterViewChecked {
|
||||
this.testStatus = 'DISCONNECTED';
|
||||
this.testButton = 'Test';
|
||||
this.showSpinner = false;
|
||||
this.info = [];
|
||||
}
|
||||
|
||||
scrollToBottom(): void {
|
||||
try {
|
||||
this.myScrollContainer.nativeElement.scrollTop = this.myScrollContainer.nativeElement.scrollHeight;
|
||||
if (!this.lockScroll) {
|
||||
this.myScrollContainer.nativeElement.scrollTop = this.myScrollContainer.nativeElement.scrollHeight;
|
||||
}
|
||||
} catch (err) {
|
||||
console.log('[Error]:' + err.toString());
|
||||
console.error('[Error]:' + err.toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,36 +0,0 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Http, Headers, RequestOptions } from '@angular/http';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
@Injectable()
|
||||
export class CredentialsService {
|
||||
|
||||
url: string;
|
||||
|
||||
constructor(private http: Http) {
|
||||
this.url = 'https://' + location.hostname + ':8443'
|
||||
}
|
||||
|
||||
getSessionId(secret: string) {
|
||||
let headers = new Headers({ 'Authorization': 'Basic ' + btoa('OPENVIDUAPP:' + secret) });
|
||||
let options = new RequestOptions({ headers });
|
||||
return this.http.post('api/sessions', options)
|
||||
.map(response => response.json())
|
||||
.catch(error => this.handleError(error));
|
||||
}
|
||||
|
||||
getToken(sessionId: string, secret: string) {
|
||||
let body = JSON.stringify({ "session": sessionId, "role": "PUBLISHER", "data": "" });
|
||||
let headers = new Headers({ 'Authorization': 'Basic ' + btoa('OPENVIDUAPP:' + secret), 'Content-Type': 'application/json' });
|
||||
let options = new RequestOptions({ headers });
|
||||
return this.http.post('api/tokens', body, options)
|
||||
.map(response => response.json())
|
||||
.catch(error => this.handleError(error));
|
||||
}
|
||||
|
||||
private handleError(error: any) {
|
||||
console.error(error);
|
||||
return Observable.throw('Server error (' + error.status + '): ' + error.text())
|
||||
}
|
||||
|
||||
}
|
||||
@ -444,4 +444,8 @@ public class NotificationRoomManager {
|
||||
public String newRandomUserName(String token, String roomId){
|
||||
return this.internalManager.newRandomUserName(token, roomId);
|
||||
}
|
||||
|
||||
public void newInsecureUser(String pid){
|
||||
this.internalManager.newInsecureUser(pid);
|
||||
}
|
||||
}
|
||||
|
||||
@ -90,6 +90,8 @@ public class RoomManager {
|
||||
private final ConcurrentMap<String, ConcurrentHashMap<String, Token>> sessionidTokenTokenobj = new ConcurrentHashMap<>();
|
||||
private final ConcurrentMap<String, ConcurrentHashMap<String, String>> sessionidUsernameToken = new ConcurrentHashMap<>();
|
||||
|
||||
private final ConcurrentMap<String, Boolean> usernameInsecure = new ConcurrentHashMap<>();
|
||||
|
||||
private volatile boolean closed = false;
|
||||
|
||||
public RoomManager() {
|
||||
@ -178,6 +180,16 @@ public class RoomManager {
|
||||
if (sessionidTokenTokenobj.get(roomName) != null) {
|
||||
sessionidTokenTokenobj.get(roomName).remove(token);
|
||||
}
|
||||
boolean stillParticipant = false;
|
||||
for (Room r : rooms.values()) {
|
||||
if (r.getParticipant(participantId) != null){
|
||||
stillParticipant = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!stillParticipant) {
|
||||
usernameInsecure.remove(participantId);
|
||||
}
|
||||
}
|
||||
|
||||
showMap();
|
||||
@ -967,8 +979,8 @@ public class RoomManager {
|
||||
return getParticipant(pid).getRoom().getName();
|
||||
}
|
||||
|
||||
public boolean isParticipantInRoom(String token, String roomId) throws OpenViduException {
|
||||
if (openviduConf.getOpenViduSecurity()) {
|
||||
public boolean isParticipantInRoom(String token, String roomId, String pid) throws OpenViduException {
|
||||
if (!this.isInsecureUser(pid)) {
|
||||
if (this.sessionidTokenTokenobj.get(roomId) != null) {
|
||||
return this.sessionidTokenTokenobj.get(roomId).containsKey(token);
|
||||
} else{
|
||||
@ -983,8 +995,8 @@ public class RoomManager {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isPublisherInRoom(String userName, String roomId) {
|
||||
if (openviduConf.getOpenViduSecurity()) {
|
||||
public boolean isPublisherInRoom(String userName, String roomId, String pid) {
|
||||
if (!this.isInsecureUser(pid)) {
|
||||
if (this.sessionidUsernameToken.get(roomId) != null){
|
||||
String token = this.sessionidUsernameToken.get(roomId).get(userName);
|
||||
if (token != null){
|
||||
@ -1000,6 +1012,14 @@ public class RoomManager {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isInsecureUser(String pid) {
|
||||
if(this.usernameInsecure.containsKey(pid)) {
|
||||
System.out.println("The user with pid " + pid + " is an INSECURE user");
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public String getTokenClientMetadata(String userName, String roomId) throws OpenViduException {
|
||||
if (this.sessionidUsernameToken.get(roomId) != null && this.sessionidTokenTokenobj.get(roomId) != null){
|
||||
String token = this.sessionidUsernameToken.get(roomId).get(userName);
|
||||
@ -1054,9 +1074,7 @@ public class RoomManager {
|
||||
if (this.sessionidUsernameToken.get(roomId) != null && this.sessionidTokenTokenobj.get(roomId) != null) {
|
||||
if(metadataFormatCorrect(metadata)){
|
||||
String token = new BigInteger(130, new SecureRandom()).toString(32);
|
||||
if (openviduConf.getOpenViduSecurity()) { // Store the token only if security is enabled
|
||||
this.sessionidTokenTokenobj.get(roomId).put(token, new Token(token, role, metadata));
|
||||
}
|
||||
this.sessionidTokenTokenobj.get(roomId).put(token, new Token(token, role, metadata));
|
||||
showMap();
|
||||
return token;
|
||||
}
|
||||
@ -1071,21 +1089,21 @@ public class RoomManager {
|
||||
}
|
||||
|
||||
public String newRandomUserName(String token, String roomId) {
|
||||
if (openviduConf.getOpenViduSecurity()) {
|
||||
if (this.sessionidUsernameToken.get(roomId) != null && this.sessionidTokenTokenobj.get(roomId) != null) {
|
||||
if (this.sessionidTokenTokenobj.get(roomId).get(token) != null) {
|
||||
return this.generateAndStoreUserName(token, roomId);
|
||||
} else {
|
||||
throw new OpenViduException(Code.USER_NOT_FOUND_ERROR_CODE, token);
|
||||
}
|
||||
if (this.sessionidUsernameToken.get(roomId) != null && this.sessionidTokenTokenobj.get(roomId) != null) {
|
||||
if (this.sessionidTokenTokenobj.get(roomId).get(token) != null) {
|
||||
return this.generateAndStoreUserName(token, roomId);
|
||||
} else {
|
||||
throw new OpenViduException(Code.ROOM_NOT_FOUND_ERROR_CODE, roomId);
|
||||
throw new OpenViduException(Code.USER_NOT_FOUND_ERROR_CODE, token);
|
||||
}
|
||||
} else {
|
||||
return token;
|
||||
throw new OpenViduException(Code.ROOM_NOT_FOUND_ERROR_CODE, roomId);
|
||||
}
|
||||
}
|
||||
|
||||
public void newInsecureUser(String pid){
|
||||
this.usernameInsecure.put(pid, true);
|
||||
}
|
||||
|
||||
private String generateAndStoreUserName(String token, String roomId) {
|
||||
String userName = new BigInteger(130, new SecureRandom()).toString(32);
|
||||
ConcurrentHashMap<String, String> usernameToken = this.sessionidUsernameToken.get(roomId);
|
||||
|
||||
@ -34,6 +34,7 @@ import io.openvidu.client.internal.ProtocolElements;
|
||||
import io.openvidu.server.core.NotificationRoomManager;
|
||||
import io.openvidu.server.core.api.pojo.ParticipantRequest;
|
||||
import io.openvidu.server.core.api.pojo.UserParticipant;
|
||||
import io.openvidu.server.security.OpenviduConfiguration;
|
||||
|
||||
/**
|
||||
* Controls the user interactions by delegating her JSON-RPC requests to the room API.
|
||||
@ -46,6 +47,9 @@ public class JsonRpcUserControl {
|
||||
|
||||
@Autowired
|
||||
protected NotificationRoomManager roomManager;
|
||||
|
||||
@Autowired
|
||||
OpenviduConfiguration openviduConf;
|
||||
|
||||
public JsonRpcUserControl() {}
|
||||
|
||||
@ -55,15 +59,21 @@ public class JsonRpcUserControl {
|
||||
|
||||
String roomId = getStringParam(request, ProtocolElements.JOINROOM_ROOM_PARAM);
|
||||
String token = getStringParam(request, ProtocolElements.JOINROOM_TOKEN_PARAM);
|
||||
String pid = participantRequest.getParticipantId();
|
||||
|
||||
if(roomManager.getRoomManager().isParticipantInRoom(token, roomId)){
|
||||
if (openviduConf.isOpenViduSecret(getStringParam(request, ProtocolElements.JOINROOM_SECRET_PARAM))) {
|
||||
roomManager.newInsecureUser(pid);
|
||||
}
|
||||
|
||||
if(roomManager.getRoomManager().isParticipantInRoom(token, roomId, pid)){
|
||||
|
||||
String userName = roomManager.newRandomUserName(token, roomId);
|
||||
String clientMetadata = getStringParam(request, ProtocolElements.JOINROOM_METADATA_PARAM);
|
||||
|
||||
if(roomManager.getRoomManager().metadataFormatCorrect(clientMetadata)){
|
||||
|
||||
this.roomManager.getRoomManager().setTokenClientMetadata(userName, roomId, clientMetadata);
|
||||
String userName = roomManager.newRandomUserName(token, roomId);
|
||||
|
||||
roomManager.getRoomManager().setTokenClientMetadata(userName, roomId, clientMetadata);
|
||||
|
||||
boolean dataChannels = false;
|
||||
if (request.getParams().has(ProtocolElements.JOINROOM_DATACHANNELS_PARAM)) {
|
||||
@ -85,7 +95,7 @@ public class JsonRpcUserControl {
|
||||
} else {
|
||||
System.out.println("Error: sessionId or token not valid");
|
||||
throw new OpenViduException(Code.USER_UNAUTHORIZED_ERROR_CODE,
|
||||
"Unable to join room. The user does not have a valid token");
|
||||
"Unable to join room. The user is not authorized");
|
||||
}
|
||||
}
|
||||
|
||||
@ -96,7 +106,7 @@ public class JsonRpcUserControl {
|
||||
String participantName = roomManager.getRoomManager().getParticipantName(pid);
|
||||
String roomName = roomManager.getRoomManager().getRoomNameFromParticipantId(pid);
|
||||
|
||||
if (roomManager.getRoomManager().isPublisherInRoom(participantName, roomName)) {
|
||||
if (roomManager.getRoomManager().isPublisherInRoom(participantName, roomName, pid)) {
|
||||
|
||||
String sdpOffer = getStringParam(request, ProtocolElements.PUBLISHVIDEO_SDPOFFER_PARAM);
|
||||
boolean audioOnly = getBooleanParam(request, ProtocolElements.PUBLISHVIDEO_AUDIOONLY_PARAM);
|
||||
|
||||
@ -15,9 +15,6 @@ public class OpenviduConfiguration {
|
||||
@Value("${openvidu.secret}")
|
||||
private String openviduSecret;
|
||||
|
||||
@Value("${openvidu.security}")
|
||||
private boolean openviduSecurity; // true, false
|
||||
|
||||
public String getOpenViduPublicUrl() {
|
||||
return this.openviduPublicUrl;
|
||||
}
|
||||
@ -29,9 +26,9 @@ public class OpenviduConfiguration {
|
||||
public String getOpenViduSecret() {
|
||||
return this.openviduSecret;
|
||||
}
|
||||
|
||||
public boolean getOpenViduSecurity() {
|
||||
return this.openviduSecurity;
|
||||
|
||||
public boolean isOpenViduSecret(String secret) {
|
||||
return secret.equals(this.getOpenViduSecret());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -7,5 +7,4 @@ server.address: 0.0.0.0
|
||||
kms.uris=[\"ws://localhost:8888/kurento\"]
|
||||
|
||||
openvidu.secret: MY_SECRET
|
||||
openvidu.security: false
|
||||
openvidu.publicurl: ngrok
|
||||
@ -9,5 +9,4 @@ server.ssl.key-alias: openvidu-selfsigned
|
||||
kms.uris=[\"ws://localhost:8888/kurento\"]
|
||||
|
||||
openvidu.secret: MY_SECRET
|
||||
openvidu.security: true
|
||||
openvidu.publicurl: local
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@ -1,12 +1,12 @@
|
||||
webpackJsonp([2,4],{
|
||||
|
||||
/***/ 180:
|
||||
/***/ 179:
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
// style-loader: Adds some css to the DOM by adding a <style> tag
|
||||
|
||||
// load the styles
|
||||
var content = __webpack_require__(259);
|
||||
var content = __webpack_require__(258);
|
||||
if(typeof content === 'string') content = [[module.i, content, '']];
|
||||
// add the styles to the DOM
|
||||
var update = __webpack_require__(374)(content, {});
|
||||
@ -27,7 +27,7 @@ if(false) {
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 258:
|
||||
/***/ 257:
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
exports = module.exports = __webpack_require__(37)(false);
|
||||
@ -42,12 +42,12 @@ exports.push([module.i, ".mat-elevation-z0{box-shadow:0 0 0 0 rgba(0,0,0,.2),0 0
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 259:
|
||||
/***/ 258:
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
exports = module.exports = __webpack_require__(37)(false);
|
||||
// imports
|
||||
exports.i(__webpack_require__(258), "");
|
||||
exports.i(__webpack_require__(257), "");
|
||||
|
||||
// module
|
||||
exports.push([module.i, "html,\nbody {\n height: 100%;\n margin: 0;\n padding: 0;\n background: #4d4d4d;\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0.05);\n}\n\nmain {\n height: 100%;\n}\n\nli {\n list-style: none;\n}\n\nvideo {\n width: 100%;\n}\n\n.mat-spinner path {\n stroke: #4d4d4d;\n}", ""]);
|
||||
@ -164,7 +164,7 @@ function toComment(sourceMap) {
|
||||
return '/*# ' + data + ' */';
|
||||
}
|
||||
|
||||
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(72).Buffer))
|
||||
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(71).Buffer))
|
||||
|
||||
/***/ }),
|
||||
|
||||
@ -424,12 +424,12 @@ function updateLink(linkElement, obj) {
|
||||
/***/ 391:
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
module.exports = __webpack_require__(180);
|
||||
module.exports = __webpack_require__(179);
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 71:
|
||||
/***/ 70:
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
@ -551,7 +551,7 @@ function fromByteArray (uint8) {
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 72:
|
||||
/***/ 71:
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
@ -565,9 +565,9 @@ function fromByteArray (uint8) {
|
||||
|
||||
|
||||
|
||||
var base64 = __webpack_require__(71)
|
||||
var ieee754 = __webpack_require__(89)
|
||||
var isArray = __webpack_require__(90)
|
||||
var base64 = __webpack_require__(70)
|
||||
var ieee754 = __webpack_require__(88)
|
||||
var isArray = __webpack_require__(89)
|
||||
|
||||
exports.Buffer = Buffer
|
||||
exports.SlowBuffer = SlowBuffer
|
||||
@ -2349,7 +2349,7 @@ function isnan (val) {
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 89:
|
||||
/***/ 88:
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
exports.read = function (buffer, offset, isLE, mLen, nBytes) {
|
||||
@ -2440,7 +2440,7 @@ exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 90:
|
||||
/***/ 89:
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
var toString = {}.toString;
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user