Class AbstractSQLCoreProvider

java.lang.Object
pro.gravit.launchserver.auth.core.AuthCoreProvider
pro.gravit.launchserver.auth.core.AbstractSQLCoreProvider
All Implemented Interfaces:
AutoCloseable, AuthSupportSudo, Reconfigurable
Direct Known Subclasses:
MySQLCoreProvider, PostgresSQLCoreProvider, SQLCoreProvider

public abstract class AbstractSQLCoreProvider extends AuthCoreProvider implements AuthSupportSudo
Abstract SQL-backed AuthCoreProvider.

Configuration fields (serialized)

Adding an optional user-table column

Override registerOptionalColumns() and call registerColumnFeature(ColumnFeature) for each optional column. The feature is automatically included in SELECT lists and ResultSet mapping only when its column name is non-null — no other methods need to be touched.
// Example: totpSecret optional column in a subclass
public String totpSecretColumn;   // null = feature disabled

@Override
protected void registerOptionalColumns() {
    super.registerOptionalColumns();
    registerColumnFeature(ColumnFeature.of(
        totpSecretColumn,
        (user, rs) -> ((MyUser) user).totpSecret = rs.getString(totpSecretColumn)
    ));
}