Skip to content
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
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ You can also create your own translation file and, if you want, you can share it
<li>Custom MySQL tables/columns names (useful with forum databases)</li>
<li><strong>Cached database queries!</strong></li>
<li><strong>Fully compatible with Citizens2, CombatTag, CombatTagPlus!</strong></li>
<li><strong>Velocity proxy bridge for inter-server authentication.</strong></li>
<li>Compatible with Minecraft mods like <strong>BuildCraft or RedstoneCraft</strong></li>
<li>Graphical login/register dialogs, with optional Paper/Folia pre-join dialogs</li>
<li>Restricted users (associate a username with an IP)</li>
Expand Down Expand Up @@ -123,8 +124,8 @@ AuthMe can display graphical login/register dialogs instead of chat-based prompt
## Requirements

##### Compiling requirements:
>- JDK 17+ for `authme-core` and `authme-spigot-legacy`
>- JDK 21+ for the full multi-module build (`authme-spigot-1.21`, `authme-paper-common`, `authme-paper`, `authme-folia`)
>- JDK 17+ for `authme-core`, `authme-tools`, and `authme-spigot-legacy`
>- JDK 21+ for the full multi-module build (`authme-bungee`, `authme-spigot-1.21`, `authme-paper-common`, `authme-paper`, `authme-folia`, `authme-velocity`)
>- Maven (3.8.8+)
>- Git/GitHub (Optional)

Expand All @@ -139,6 +140,8 @@ AuthMe can display graphical login/register dialogs instead of chat-based prompt
>- Use the jar matching your server platform/version
>- Java 17+ for `AuthMe-*-Spigot-Legacy.jar` (Spigot 1.16.x – 1.19.x)
>- Java 21+ for:
> - `AuthMe-*-Bungee.jar` (BungeeCord / Waterfall-compatible 1.19 API)
> - `AuthMe-*-Velocity.jar` (Velocity 3.4+ proxy bridge)
> - `AuthMe-*-Spigot-1.21.jar` (Spigot 1.20.x – 1.21.x)
> - `AuthMe-*-Paper.jar` (Paper 1.21+)
> - `AuthMe-*-Folia.jar` (Folia 1.21+)
Expand Down
185 changes: 185 additions & 0 deletions authme-bungee/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>fr.xephi</groupId>
<artifactId>authme-parent</artifactId>
<version>${revision}</version>
</parent>

<artifactId>authme-bungee</artifactId>
<packaging>jar</packaging>
<name>AuthMeBungee</name>
<description>AuthMe proxy bridge for BungeeCord</description>

<properties>
<module.java.version>21</module.java.version>
<module.classifier>Bungee</module.classifier>
</properties>

<dependencies>
<dependency>
<groupId>net.md-5</groupId>
<artifactId>bungeecord-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>ch.jalu</groupId>
<artifactId>configme</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<finalName>AuthMe-${project.version}-${module.classifier}</finalName>

<resources>
<resource>
<directory>..</directory>
<filtering>false</filtering>
<includes>
<include>LICENSE</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>

<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<executions>
<execution>
<id>shade</id>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>generate-build-info-source</id>
<phase>generate-sources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/generated-sources/build-info</outputDirectory>
<resources>
<resource>
<directory>src/main/java-templates</directory>
<filtering>true</filtering>
<includes>
<include>**/*.java</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.6.1</version>
<executions>
<execution>
<id>add-generated-build-info-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>${project.build.directory}/generated-sources/build-info</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>remove-original-shaded-jar</id>
<phase>package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<delete file="${project.build.directory}/original-${project.build.finalName}.jar" quiet="true"/>
</target>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<configuration>
<finalName>${project.build.finalName}</finalName>
</configuration>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<finalName>${project.build.finalName}</finalName>
<source>${module.java.version}</source>
<detectOfflineLinks>false</detectOfflineLinks>
</configuration>
<executions>
<execution>
<id>attach-javadoc</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

<repositories>
<repository>
<id>oss-repo</id>
<url>https://oss.sonatype.org/content/groups/public</url>
</repository>
</repositories>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package fr.xephi.authme.bungee;

import net.md_5.bungee.api.plugin.Plugin;

abstract class AbstractAuthMeBungeePlugin extends Plugin {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package fr.xephi.authme.bungee;

public final class AuthMeBungeePlugin extends AbstractAuthMeBungeePlugin {

private BungeeConfigManager configManager;
private BungeeProxyBridge proxyBridge;

@Override
public void onEnable() {
configManager = new BungeeConfigManager(getDataFolder().toPath());
BungeeAuthenticationStore authenticationStore = new BungeeAuthenticationStore();
proxyBridge = new BungeeProxyBridge(getProxy(), getLogger(), configManager.getConfiguration(), authenticationStore);
getProxy().getPluginManager().registerListener(this, proxyBridge);
getProxy().getPluginManager().registerCommand(this, new BungeeReloadCommand(configManager, proxyBridge));
proxyBridge.logConfigurationDetails();
proxyBridge.broadcastProxyStartedHandshake();
}

@Override
public void onDisable() {
proxyBridge.shutdown();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package fr.xephi.authme.bungee;

import net.md_5.bungee.api.connection.ProxiedPlayer;

import java.util.Locale;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;

final class BungeeAuthenticationStore {

private final Set<String> authenticatedPlayers = ConcurrentHashMap.newKeySet();

void markAuthenticated(String playerName) {
authenticatedPlayers.add(normalizeName(playerName));
}

void markLoggedOut(String playerName) {
authenticatedPlayers.remove(normalizeName(playerName));
}

boolean isAuthenticated(ProxiedPlayer player) {
return isAuthenticated(player.getName());
}

boolean isAuthenticated(String playerName) {
return authenticatedPlayers.contains(normalizeName(playerName));
}

void clear(ProxiedPlayer player) {
markLoggedOut(player.getName());
}

private static String normalizeName(String playerName) {
return playerName.toLowerCase(Locale.ROOT);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package fr.xephi.authme.bungee;

import ch.jalu.configme.SettingsManager;
import ch.jalu.configme.SettingsManagerBuilder;
import fr.xephi.authme.bungee.config.BungeeConfigProperties;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;

final class BungeeConfigManager {

private final SettingsManager settingsManager;
private final BungeeProxyConfiguration configuration;

BungeeConfigManager(Path dataDirectory) {
try {
Files.createDirectories(dataDirectory);
} catch (IOException e) {
throw new IllegalStateException("Could not create AuthMe Bungee data directory", e);
}

this.settingsManager = SettingsManagerBuilder.withYamlFile(dataDirectory.resolve("config.yml").toFile())
.configurationData(BungeeConfigProperties.class)
.migrationService(new HmacSecretMigrationService())
.create();
this.configuration = BungeeProxyConfiguration.from(settingsManager);
}

BungeeProxyConfiguration getConfiguration() {
return configuration;
}

BungeeProxyConfiguration reload() {
settingsManager.reload();
return BungeeProxyConfiguration.from(settingsManager);
}
}
Loading
Loading