Class SQLCoreProvider
java.lang.Object
pro.gravit.launchserver.auth.core.AuthCoreProvider
pro.gravit.launchserver.auth.core.AbstractSQLCoreProvider
pro.gravit.launchserver.auth.core.SQLCoreProvider
- All Implemented Interfaces:
AutoCloseable, AuthSupport, AuthSupportExtendedCheckServer, AuthSupportHardware, AuthSupportSudo, Reconfigurable
public class SQLCoreProvider
extends AbstractSQLCoreProvider
implements AuthSupportHardware, AuthSupportExtendedCheckServer
SQL-backed auth provider with hardware-ID tracking and optional TOTP support.
Required configuration fields (in addition to base class)
hardwareIdColumn– FK column in the user table pointing to the hwids table
Optional configuration fields
AbstractSQLCoreProvider.totpSecretColumn– when set, the TOTP secret is read from this column and stored onAbstractSQLCoreProvider.SQLUser.totpSecret. Whennullthe column is completely absent from every SELECT query and ResultSet mapping.tableHWID– defaults to"hwids"tableHWIDLog– defaults to"hwidLog"criticalCompareLevel– fuzzy-match threshold, defaults to1.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classImmutable hardware record (except mutablepublicKeyandbanned).classSession with lazy-loaded hardware info.Nested classes/interfaces inherited from class AbstractSQLCoreProvider
AbstractSQLCoreProvider.ColumnFeature<U,T> Nested classes/interfaces inherited from class AuthCoreProvider
AuthCoreProvider.OAuthAccessTokenExpired, AuthCoreProvider.PasswordVerifyReportNested classes/interfaces inherited from interface AuthSupportHardware
AuthSupportHardware.HardwareInfoCompareResult -
Field Summary
FieldsModifier and TypeFieldDescriptiondoubleMinimum similarity level for a hardware record to be considered a match ingetHardwareInfoByData(HardwareReportRequest.HardwareInfo).Column in the user table that holds the hardware-ID foreign key (required).Hikari connection-pool config (required).Hardware-info table name.Hardware-change audit-log table name.Fields inherited from class AbstractSQLCoreProvider
accessTokenColumn, codeGenerator, customQueryByLoginSQL, customQueryByUsernameSQL, customQueryByUUIDSQL, customQueryPermissionsByUUIDSQL, customQueryRolesByUserUUID, customUpdateAuthSQL, customUpdateServerIdSQL, expireSeconds, logger, passwordColumn, passwordVerifier, permissionsPermissionColumn, permissionsTable, permissionsUUIDColumn, rolesNameColumn, rolesTable, rolesUUIDColumn, serverIDColumn, table, timeProvider, totpSecretColumn, usernameColumn, uuidColumn, verifierFields inherited from class AuthCoreProvider
pair, providers, server -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddPublicKeyToHardwareInfo(UserHardware hardware, byte[] publicKey) voidbanHardware(UserHardware hardware) protected voidBuilds all transient SQL strings.voidclose()voidconnectUserAndHardware(UserSession userSession, UserHardware hardware) protected SQLCoreProvider.SQLUserReads all required columns plushardwareIdColumn, then lets the base class apply every registered optional column (includingAbstractSQLCoreProvider.totpSecretColumnwhen enabled) via theAbstractSQLCoreProvider.ColumnFeatureregistry.createHardwareInfo(pro.gravit.launcher.base.request.secure.HardwareReportRequest.HardwareInfo info, byte[] publicKey) protected SQLCoreProvider.SQLUserSessionextendedCheckServer(Client client, String username, String serverID) getHardwareInfoByData(pro.gravit.launcher.base.request.secure.HardwareReportRequest.HardwareInfo info) getHardwareInfoByPublicKey(byte[] publicKey) getUsersByHardwareInfo(UserHardware hardware) voidinit(LaunchServer server, AuthProviderPair pair) protected StringhardwareIdColumnis a required column for this provider, so it is appended here rather than through the optional registry.voidunbanHardware(UserHardware hardware) Methods inherited from class AbstractSQLCoreProvider
applyOptionalColumns, authorize, checkServer, constructUser, executeSingleUpdate, getDetails, getUserByLogin, getUserByUsername, getUserByUUID, getUserSessionByOAuthAccessToken, isPermissionsEnabled, isRolesEnabled, joinServer, loadPermissions, refreshAccessToken, registerColumnFeature, registerOptionalColumns, safeQueryUser, sudo, updateAuth, updateServerID, verifyTotpCodeMethods inherited from class AuthCoreProvider
authorize, getCommands, isSupport, registerProviders, verifyAuthMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface AuthSupportHardware
compareHardwareInfo, normalizeHardwareInfoMethods inherited from interface Reconfigurable
defaultCommandsMap
-
Field Details
-
holder
Hikari connection-pool config (required). -
hardwareIdColumn
Column in the user table that holds the hardware-ID foreign key (required). This is a required column for this provider — it is always included in SELECT queries viamakeUserCols(), not via the optional registry. -
tableHWID
Hardware-info table name. -
tableHWIDLog
Hardware-change audit-log table name. -
criticalCompareLevel
public double criticalCompareLevelMinimum similarity level for a hardware record to be considered a match ingetHardwareInfoByData(HardwareReportRequest.HardwareInfo). -
customFindHardwareByPublicKey
-
customFindHardwareByData
-
customFindHardwareById
-
customCreateHardware
-
customCreateHWIDLog
-
customUpdateHardwarePublicKey
-
customUsersByHwidId
-
-
Constructor Details
-
SQLCoreProvider
public SQLCoreProvider()
-
-
Method Details
-
getSQLConfig
- Specified by:
getSQLConfigin classAbstractSQLCoreProvider
-
init
- Overrides:
initin classAbstractSQLCoreProvider
-
makeUserCols
hardwareIdColumnis a required column for this provider, so it is appended here rather than through the optional registry. Optional columns (e.g.AbstractSQLCoreProvider.totpSecretColumn) are appended byAbstractSQLCoreProviderautomatically after the required set.- Overrides:
makeUserColsin classAbstractSQLCoreProvider
-
buildPreparedQueries
protected void buildPreparedQueries()Description copied from class:AbstractSQLCoreProviderBuilds all transient SQL strings. Called once perAbstractSQLCoreProvider.init(LaunchServer, AuthProviderPair)after the optional-column registry is finalised.Subclasses that need additional SQL should override this and call
super.buildPreparedQueries()first.- Overrides:
buildPreparedQueriesin classAbstractSQLCoreProvider
-
constructUserFromRow
Reads all required columns plushardwareIdColumn, then lets the base class apply every registered optional column (includingAbstractSQLCoreProvider.totpSecretColumnwhen enabled) via theAbstractSQLCoreProvider.ColumnFeatureregistry.- Overrides:
constructUserFromRowin classAbstractSQLCoreProvider- Throws:
SQLException
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Overrides:
closein classAbstractSQLCoreProvider
-
getHardwareInfoByPublicKey
- Specified by:
getHardwareInfoByPublicKeyin interfaceAuthSupportHardware
-
getHardwareInfoByData
public UserHardware getHardwareInfoByData(pro.gravit.launcher.base.request.secure.HardwareReportRequest.HardwareInfo info) - Specified by:
getHardwareInfoByDatain interfaceAuthSupportHardware
-
getHardwareInfoById
- Specified by:
getHardwareInfoByIdin interfaceAuthSupportHardware
-
createHardwareInfo
public UserHardware createHardwareInfo(pro.gravit.launcher.base.request.secure.HardwareReportRequest.HardwareInfo info, byte[] publicKey) - Specified by:
createHardwareInfoin interfaceAuthSupportHardware
-
connectUserAndHardware
- Specified by:
connectUserAndHardwarein interfaceAuthSupportHardware
-
addPublicKeyToHardwareInfo
- Specified by:
addPublicKeyToHardwareInfoin interfaceAuthSupportHardware
-
getUsersByHardwareInfo
- Specified by:
getUsersByHardwareInfoin interfaceAuthSupportHardware
-
banHardware
- Specified by:
banHardwarein interfaceAuthSupportHardware
-
unbanHardware
- Specified by:
unbanHardwarein interfaceAuthSupportHardware
-
extendedCheckServer
- Specified by:
extendedCheckServerin interfaceAuthSupportExtendedCheckServer
-
createSession
- Overrides:
createSessionin classAbstractSQLCoreProvider
-