Guest User

Untitled

a guest
Apr 26th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. /**
  2. * Handles the login event
  3. */
  4. private fun handleLogin() {
  5. val username = loginform_username.getContent()
  6. val password = loginform_password.getContent()
  7.  
  8. Log.d(TAG, "handleLogin - username = $username, password = $password")
  9.  
  10. /**
  11. * This is very "identityManager" specific code, so we check for the various
  12. * bits of support. The "Mock" version will just
  13. */
  14. when (identityManager) {
  15. is MockIdentityManager -> {
  16. Log.i(TAG, "Invoking Mock User Authentication")
  17. val user = User()
  18. user.username = username
  19. userIsAuthenticated(user)
  20. }
  21.  
  22. is AWSIdentityManager -> {
  23. Log.i(TAG, "Invoking Amazon Cognito User Authentication")
  24. thread(start = true) {
  25. val cognitoUser = (identityManager as AWSIdentityManager).userPool.currentUser
  26. cognitoUser.getSession(this)
  27. }
  28. }
  29.  
  30. else -> {
  31. throw RuntimeException("Unknown IdentityManager implementation")
  32. }
  33. }
  34. }
Add Comment
Please, Sign In to add comment