Class MySQLCoreProvider
java.lang.Object
pro.gravit.launchserver.auth.core.AuthCoreProvider
pro.gravit.launchserver.auth.core.AbstractSQLCoreProvider
pro.gravit.launchserver.auth.core.MySQLCoreProvider
- All Implemented Interfaces:
AutoCloseable, AuthSupport, AuthSupportHardware, AuthSupportSudo, Reconfigurable
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classclassNested classes/interfaces inherited from class AbstractSQLCoreProvider
AbstractSQLCoreProvider.ColumnFeature<U,T>, AbstractSQLCoreProvider.SQLUser, AbstractSQLCoreProvider.SQLUserSession Modifier and TypeClassDescriptionstatic final classDescribes a single optional column in the user table.static classstatic classNested classes/interfaces inherited from class AuthCoreProvider
AuthCoreProvider.OAuthAccessTokenExpired, AuthCoreProvider.PasswordVerifyReportModifier and TypeClassDescriptionstatic classstatic classNested classes/interfaces inherited from interface AuthSupportHardware
AuthSupportHardware.HardwareInfoCompareResult -
Field Summary
FieldsModifier and TypeFieldDescriptiondoubleFields 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, verifierModifier and TypeFieldDescriptionprotected final dev.samstevens.totp.code.CodeGeneratorlongSession / access-token lifetime in seconds (default: 1 hour).protected final org.apache.logging.log4j.Loggerprotected final dev.samstevens.totp.time.TimeProviderOptional TOTP secret column in the user table.protected final dev.samstevens.totp.code.CodeVerifierFields inherited from class AuthCoreProvider
pair, providers, serverModifier and TypeFieldDescriptionprotected AuthProviderPairstatic final pro.gravit.utils.ProviderMap<AuthCoreProvider> protected LaunchServer -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddPublicKeyToHardwareInfo(UserHardware hardware, byte[] publicKey) voidbanHardware(UserHardware hardware) voidconnectUserAndHardware(UserSession userSession, UserHardware hardware) protected MySQLCoreProvider.MySQLUserconstructUser(ResultSet set) Advancessetby one row and delegates toAbstractSQLCoreProvider.constructUserFromRow(ResultSet), or returnsnullif the result set is empty.createHardwareInfo(pro.gravit.launcher.base.request.secure.HardwareReportRequest.HardwareInfo hardwareInfo, byte[] publicKey) protected AbstractSQLCoreProvider.SQLUserSessiongetHardwareInfoByData(pro.gravit.launcher.base.request.secure.HardwareReportRequest.HardwareInfo info) getHardwareInfoByPublicKey(byte[] publicKey) getUsersByHardwareInfo(UserHardware hardware) voidinit(LaunchServer server, AuthProviderPair pair) protected StringReturns the comma-separated column list used in SELECT queries.voidunbanHardware(UserHardware hardware) Methods inherited from class AbstractSQLCoreProvider
applyOptionalColumns, authorize, buildPreparedQueries, checkServer, close, constructUserFromRow, executeSingleUpdate, getDetails, getUserByLogin, getUserByUsername, getUserByUUID, getUserSessionByOAuthAccessToken, isPermissionsEnabled, isRolesEnabled, joinServer, loadPermissions, refreshAccessToken, registerColumnFeature, registerOptionalColumns, safeQueryUser, sudo, updateAuth, updateServerID, verifyTotpCodeModifier and TypeMethodDescriptionprotected final voidApplies all registered optional columns touserfrom the current row ofset.authorize(String login, AuthResponse.AuthContext context, pro.gravit.launcher.base.request.auth.AuthRequest.AuthPasswordInterface password, boolean minecraftAccess) protected voidBuilds all transient SQL strings.checkServer(Client client, String username, String serverID) voidclose()protected AbstractSQLCoreProvider.SQLUserConstructs aAbstractSQLCoreProvider.SQLUserfrom the current ResultSet row.protected intexecuteSingleUpdate(String sql, String p1, String p2) Runs a two-parameter UPDATE and returns the affected-row count.List<pro.gravit.launcher.base.events.request.GetAvailabilityAuthRequestEvent.AuthAvailabilityDetails> getDetails(Client client) getUserByLogin(String login) getUserByUsername(String username) getUserByUUID(UUID uuid) getUserSessionByOAuthAccessToken(String accessToken) booleanbooleanbooleanpro.gravit.launcher.base.ClientPermissionsloadPermissions(String uuid) refreshAccessToken(String refreshToken, AuthResponse.AuthContext context) protected final voidregisterColumnFeature(AbstractSQLCoreProvider.ColumnFeature<?, ?> feature) Registers one optional column.protected voidOverride to declare optional user-table columns.protected final AbstractSQLCoreProvider.SQLUsersafeQueryUser(String sql, String param) Executes a single-parameter SELECT and maps the result to aAbstractSQLCoreProvider.SQLUser(with permissions).protected voidupdateAuth(User user, String accessToken) protected booleanupdateServerID(User user, String serverID) protected voidverifyTotpCode(AbstractSQLCoreProvider.SQLUser user, String totpCode) Methods inherited from class AuthCoreProvider
authorize, getCommands, isSupport, registerProviders, verifyAuthModifier and TypeMethodDescriptionauthorize(User user, AuthResponse.AuthContext context, pro.gravit.launcher.base.request.auth.AuthRequest.AuthPasswordInterface password, boolean minecraftAccess) Gets a list of commands available for this object.<T> Tstatic voidvoidverifyAuth(AuthResponse.AuthContext context) Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface AuthSupportHardware
compareHardwareInfo, normalizeHardwareInfoModifier and TypeMethodDescriptioncompareHardwareInfo(pro.gravit.launcher.base.request.secure.HardwareReportRequest.HardwareInfo first, pro.gravit.launcher.base.request.secure.HardwareReportRequest.HardwareInfo second) default voidnormalizeHardwareInfo(pro.gravit.launcher.base.request.secure.HardwareReportRequest.HardwareInfo hardwareInfo) Methods inherited from interface Reconfigurable
defaultCommandsMapModifier and TypeMethodDescription
-
Field Details
-
mySQLHolder
-
hardwareIdColumn
-
tableHWID
-
tableHWIDLog
-
criticalCompareLevel
public double criticalCompareLevel
-
-
Constructor Details
-
MySQLCoreProvider
public MySQLCoreProvider()
-
-
Method Details
-
getSQLConfig
- Specified by:
getSQLConfigin classAbstractSQLCoreProvider
-
init
- Overrides:
initin classAbstractSQLCoreProvider
-
makeUserCols
Description copied from class:AbstractSQLCoreProviderReturns the comma-separated column list used in SELECT queries.The base implementation covers all required columns plus every enabled optional column registered via
AbstractSQLCoreProvider.registerOptionalColumns().Subclasses that add extra required (always-present) columns should override this and append to
super.makeUserCols(). Truly optional columns belong inAbstractSQLCoreProvider.registerOptionalColumns()instead — they are appended here automatically.- Overrides:
makeUserColsin classAbstractSQLCoreProvider
-
constructUser
Description copied from class:AbstractSQLCoreProviderAdvancessetby one row and delegates toAbstractSQLCoreProvider.constructUserFromRow(ResultSet), or returnsnullif the result set is empty.- Overrides:
constructUserin classAbstractSQLCoreProvider- Throws:
SQLException
-
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 hardwareInfo, 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
-
createSession
protected AbstractSQLCoreProvider.SQLUserSession createSession(AbstractSQLCoreProvider.SQLUser user) - Overrides:
createSessionin classAbstractSQLCoreProvider
-