Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Adds an option to randomize user-id used when client logins. #501

Merged
merged 2 commits into from
Sep 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions jigasi-home/sip-communicator.properties
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,10 @@ org.jitsi.jigasi.xmpp.acc.USE_DEFAULT_STUN_SERVER=false
# To fix SSL/TLS required by client but not supported by server
#org.jitsi.jigasi.xmpp.acc.ALLOW_NON_SECURE=true

# Can be used in combination with jitsi-meet module mod_auth_jitsi-shared-secret
# To have jigasi use a random username on every call
#org.jitsi.jigasi.xmpp.acc.UNIQUE_USER_ID=true

# If you want to disconnect jigasi calls automatically when all web users have
# left, you can set the following property to false.
# org.jitsi.jigasi.ALLOW_ONLY_JIGASIS_IN_ROOM=true
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

<properties>
<assembly.skipAssembly>true</assembly.skipAssembly>
<jitsi-desktop.version>2.14.113297e05</jitsi-desktop.version>
<jitsi-desktop.version>2.14.77b1f5e65</jitsi-desktop.version>
<jitsi-desktop.groupId>org.jitsi.desktop</jitsi-desktop.groupId>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<slf4j.version>1.7.36</slf4j.version>
Expand Down
25 changes: 25 additions & 0 deletions src/main/java/org/jitsi/jigasi/JvbConference.java
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,11 @@ public class JvbConference
Util.createNewThreadPool("xmpp-executor-pool")
);

/**
* Used for randomizing usernames if needed.
*/
private static final Random RANDOM = new Random();

/**
* Adds the features supported by jigasi to a specific
* <tt>OperationSetJitsiMeetTools</tt> instance.
Expand Down Expand Up @@ -1649,6 +1654,26 @@ else if ("org.jitsi.jigasi.xmpp.acc.BOSH_URL_PATTERN".equals(overridenProp))
ctx.setBoshURL(value);
}
}
else if ("org.jitsi.jigasi.xmpp.acc.USER_ID".equals(overridenProp)
&& JigasiBundleActivator.getConfigurationService().getBoolean(overridePrefix + ".UNIQUE_USER_ID", false))
{
try
{
Jid jid = JidCreate.from(value);
long random = RANDOM.nextInt();
Jid newJid = JidCreate.entityBareFrom(
Localpart.from(jid.getLocalpartOrNull() + "-" + String.format("%x", random)),
jid.getDomain());

properties.put(ProtocolProviderFactory.USER_ID, newJid.toString());
}
catch (XmppStringprepException e)
{
logger.error("Error jid in org.jitsi.jigasi.xmpp.acc.USER_ID config", e);

properties.put(ProtocolProviderFactory.USER_ID, value);
}
}
else
{
properties.put(key, value);
Expand Down
Loading