Class CachedAuthHandler
java.lang.Object
pro.gravit.launchserver.auth.handler.AuthHandler
pro.gravit.launchserver.auth.handler.CachedAuthHandler
- All Implemented Interfaces:
AutoCloseable,pro.gravit.launcher.NeedGarbageCollection,Reconfigurable
- Direct Known Subclasses:
HibernateAuthHandler,JsonAuthHandler,MemoryAuthHandler,MySQLAuthHandler,PostgreSQLAuthHandler,RequestAuthHandler
public abstract class CachedAuthHandler
extends AuthHandler
implements pro.gravit.launcher.NeedGarbageCollection, Reconfigurable
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classprotected static class -
Field Summary
Fields inherited from class pro.gravit.launchserver.auth.handler.AuthHandler
providers, srv -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddEntry(CachedAuthHandler.Entry entry)auth(AuthProviderResult result)Returns the UUID associated with the accountcheckServer(String username, String serverID)Validates serverIDprotected abstract CachedAuthHandler.EntryfetchEntry(String username)protected abstract CachedAuthHandler.EntryfetchEntry(UUID uuid)voidGets a list of commands available for this object.booleanjoinServer(String username, String accessToken, String serverID)Checks assessToken for validity and saves serverID if successfulvoidloadEntryCache(Map<UUID,CachedAuthHandler.Entry> map)voidloadUsernameCache(Map<String,UUID> map)protected abstract booleanupdateAuth(UUID uuid, String username, String accessToken)protected abstract booleanupdateServerID(UUID uuid, String serverID)usernameToUUID(String username)uuidToUsername(UUID uuid)Methods inherited from class pro.gravit.launchserver.auth.handler.AuthHandler
authError, close, init, registerHandlersMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface pro.gravit.launchserver.Reconfigurable
defaultCommandsMap
-
Constructor Details
-
CachedAuthHandler
public CachedAuthHandler()
-
-
Method Details
-
getCommands
Description copied from interface:ReconfigurableGets a list of commands available for this object.- Specified by:
getCommandsin interfaceReconfigurable- Returns:
- Key - Command Name Value is a command object
-
addEntry
-
auth
Description copied from class:AuthHandlerReturns the UUID associated with the account- Specified by:
authin classAuthHandler- Parameters:
result-AuthProviderresult- Returns:
- User UUID
- Throws:
IOException- Internal Script Error
-
checkServer
Description copied from class:AuthHandlerValidates serverID- Specified by:
checkServerin classAuthHandler- Parameters:
username- user nameserverID- serverID to check- Returns:
- user UUID
- Throws:
IOException- Internal Script Error
-
fetchEntry
- Throws:
IOException
-
fetchEntry
- Throws:
IOException
-
joinServer
Description copied from class:AuthHandlerChecks assessToken for validity and saves serverID if successful- Specified by:
joinServerin classAuthHandler- Parameters:
username- user nameaccessToken- assessToken to checkserverID- serverID to save- Returns:
- true - allow, false - deny
- Throws:
IOException- Internal Script Error
-
garbageCollection
public void garbageCollection()- Specified by:
garbageCollectionin interfacepro.gravit.launcher.NeedGarbageCollection
-
getEntryCache
-
getUsernamesCache
-
loadEntryCache
-
loadUsernameCache
-
updateAuth
protected abstract boolean updateAuth(UUID uuid, String username, String accessToken) throws IOException- Throws:
IOException
-
updateServerID
- Throws:
IOException
-
usernameToUUID
- Specified by:
usernameToUUIDin classAuthHandler- Throws:
IOException
-
uuidToUsername
- Specified by:
uuidToUsernamein classAuthHandler- Throws:
IOException
-