[DOC] Документация к AuthProvider/AuthHandler

This commit is contained in:
Gravit 2019-08-28 17:56:29 +07:00
parent c5d09557da
commit 5f6da3a638
No known key found for this signature in database
GPG key ID: 061981E1E85D3216
2 changed files with 34 additions and 0 deletions

View file

@ -33,14 +33,38 @@ public static void registerHandlers() {
protected transient LaunchServer srv; protected transient LaunchServer srv;
/**
* Returns the UUID associated with the account
* @param authResult {@link pro.gravit.launchserver.auth.provider.AuthProvider} result
* @return User UUID
* @throws IOException
* Internal Script Error
*/
public abstract UUID auth(AuthProviderResult authResult) throws IOException; public abstract UUID auth(AuthProviderResult authResult) throws IOException;
/**
* Validates serverID
* @param username user name
* @param serverID serverID to check
* @return user UUID
* @throws IOException
* Internal Script Error
*/
public abstract UUID checkServer(String username, String serverID) throws IOException; public abstract UUID checkServer(String username, String serverID) throws IOException;
@Override @Override
public abstract void close() throws IOException; public abstract void close() throws IOException;
/**
* Checks assessToken for validity and saves serverID if successful
* @param username user name
* @param accessToken assessToken to check
* @param serverID serverID to save
* @return true - allow, false - deny
* @throws IOException
* Internal Script Error
*/
public abstract boolean joinServer(String username, String accessToken, String serverID) throws IOException; public abstract boolean joinServer(String username, String accessToken, String serverID) throws IOException;

View file

@ -29,6 +29,16 @@ public static void registerProviders() {
} }
/**
* Verifies the username and password
* @param login user login
* @param password user password
* @param ip user ip
* @return player privileges, effective username and authorization token
* @throws Exception
* Throws an exception {@link AuthException} {@link pro.gravit.utils.HookException} if the verification script returned a meaningful error
* In other cases, throwing an exception indicates a serious error
*/
public abstract AuthProviderResult auth(String login, String password, String ip) throws Exception; public abstract AuthProviderResult auth(String login, String password, String ip) throws Exception;
public void preAuth(String login, String password, String customText, String ip) { public void preAuth(String login, String password, String customText, String ip) {