[mirotalk] - improve OIDC check
This commit is contained in:
+22
-13
@@ -43,7 +43,7 @@ dependencies: {
|
||||
* @license For commercial use or closed source, contact us at license.mirotalk@gmail.com or purchase directly from CodeCanyon
|
||||
* @license CodeCanyon: https://codecanyon.net/item/mirotalk-p2p-webrtc-realtime-video-conferences/38376661
|
||||
* @author Miroslav Pejic - miroslav.pejic.85@gmail.com
|
||||
* @version 1.4.78
|
||||
* @version 1.4.79
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -327,23 +327,32 @@ const OIDC = {
|
||||
// Custom middleware function for OIDC authentication
|
||||
function OIDCAuth(req, res, next) {
|
||||
if (OIDC.enabled) {
|
||||
function handleHostProtected(req) {
|
||||
if (!hostCfg.protected) return;
|
||||
|
||||
const ip = authHost.getIP(req);
|
||||
hostCfg.authenticated = true;
|
||||
authHost.setAuthorizedIP(ip, true);
|
||||
// Check...
|
||||
log.debug('OIDC ------> Host protected', {
|
||||
authenticated: hostCfg.authenticated,
|
||||
authorizedIPs: authHost.getAuthorizedIPs(),
|
||||
});
|
||||
}
|
||||
|
||||
if (req.oidc.isAuthenticated()) {
|
||||
log.debug('OIDC ------> User already Authenticated');
|
||||
handleHostProtected(req);
|
||||
return next();
|
||||
}
|
||||
|
||||
// Apply requiresAuth() middleware conditionally
|
||||
requiresAuth()(req, res, function () {
|
||||
log.debug('[OIDC] ------> requiresAuth');
|
||||
log.debug('OIDC ------> requiresAuth');
|
||||
// Check if user is authenticated
|
||||
if (req.oidc.isAuthenticated()) {
|
||||
log.debug('[OIDC] ------> User isAuthenticated');
|
||||
// User is authenticated
|
||||
if (hostCfg.protected) {
|
||||
const ip = authHost.getIP(req);
|
||||
hostCfg.authenticated = true;
|
||||
authHost.setAuthorizedIP(ip, true);
|
||||
// Check...
|
||||
log.debug('[OIDC] ------> Host protected', {
|
||||
authenticated: hostCfg.authenticated,
|
||||
authorizedIPs: authHost.getAuthorizedIPs(),
|
||||
});
|
||||
}
|
||||
handleHostProtected(req);
|
||||
next();
|
||||
} else {
|
||||
// User is not authenticated
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "mirotalk",
|
||||
"version": "1.4.78",
|
||||
"version": "1.4.79",
|
||||
"description": "A free WebRTC browser-based video call",
|
||||
"main": "server.js",
|
||||
"scripts": {
|
||||
|
||||
+1
-1
@@ -73,7 +73,7 @@ let brand = {
|
||||
},
|
||||
about: {
|
||||
imageUrl: '../images/mirotalk-logo.gif',
|
||||
title: 'WebRTC P2P v1.4.78',
|
||||
title: 'WebRTC P2P v1.4.79',
|
||||
html: `
|
||||
<button
|
||||
id="support-button"
|
||||
|
||||
+2
-2
@@ -15,7 +15,7 @@
|
||||
* @license For commercial use or closed source, contact us at license.mirotalk@gmail.com or purchase directly from CodeCanyon
|
||||
* @license CodeCanyon: https://codecanyon.net/item/mirotalk-p2p-webrtc-realtime-video-conferences/38376661
|
||||
* @author Miroslav Pejic - miroslav.pejic.85@gmail.com
|
||||
* @version 1.4.78
|
||||
* @version 1.4.79
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -11039,7 +11039,7 @@ function showAbout() {
|
||||
Swal.fire({
|
||||
background: swBg,
|
||||
position: 'center',
|
||||
title: brand.about?.title && brand.about.title.trim() !== '' ? brand.about.title : 'WebRTC P2P v1.4.78',
|
||||
title: brand.about?.title && brand.about.title.trim() !== '' ? brand.about.title : 'WebRTC P2P v1.4.79',
|
||||
imageUrl: brand.about?.imageUrl && brand.about.imageUrl.trim() !== '' ? brand.about.imageUrl : images.about,
|
||||
customClass: { image: 'img-about' },
|
||||
html: `
|
||||
|
||||
Reference in New Issue
Block a user