Created
April 18, 2018 19:51
-
-
Save adrianhall/a37a76312137d4629956a7a6cb192516 to your computer and use it in GitHub Desktop.
The handleLogin() method
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Handles the login event | |
*/ | |
private fun handleLogin() { | |
val username = loginform_username.getContent() | |
val password = loginform_password.getContent() | |
Log.d(TAG, "handleLogin - username = $username, password = $password") | |
/** | |
* This is very "identityManager" specific code, so we check for the various | |
* bits of support. The "Mock" version will just | |
*/ | |
when (identityManager) { | |
is MockIdentityManager -> { | |
Log.i(TAG, "Invoking Mock User Authentication") | |
val user = User() | |
user.username = username | |
userIsAuthenticated(user) | |
} | |
is AWSIdentityManager -> { | |
Log.i(TAG, "Invoking Amazon Cognito User Authentication") | |
thread(start = true) { | |
val cognitoUser = (identityManager as AWSIdentityManager).userPool.currentUser | |
cognitoUser.getSession(this) | |
} | |
} | |
else -> { | |
throw RuntimeException("Unknown IdentityManager implementation") | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment