Package net.gini.android.authorization
Class UserCenterManager
- java.lang.Object
-
- net.gini.android.authorization.UserCenterManager
-
public class UserCenterManager extends java.lang.Object
The UserCenterManager is responsible for managing Gini users.
-
-
Constructor Summary
Constructors Constructor Description UserCenterManager(UserCenterAPICommunicator userCenterAPICommunicator)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description bolts.Task<User>
createUser(UserCredentials userCredentials)
Creates a new user which has the given client credentials.bolts.Task<User>
getUser(android.net.Uri userUri)
protected bolts.Task<Session>
getUserCenterSession()
Returns a future that will resolve to a valid session (for the User Center API!).protected bolts.Task<Session>
loginClient()
bolts.Task<Session>
loginUser(UserCredentials userCredentials)
Log-in the user which is identified with the given credentials.bolts.Task<org.json.JSONObject>
updateEmail(java.lang.String newEmail, java.lang.String oldEmail, Session giniAPISession)
Update the email of the logged in user.
-
-
-
Constructor Detail
-
UserCenterManager
public UserCenterManager(UserCenterAPICommunicator userCenterAPICommunicator)
- Parameters:
userCenterAPICommunicator
- An implementation of the UserCenterAPIManager which handles the communication with the Gini User Center API for this manager instance.
-
-
Method Detail
-
createUser
public bolts.Task<User> createUser(UserCredentials userCredentials)
Creates a new user which has the given client credentials.- Parameters:
userCredentials
- The user's credentials.- Returns:
- A (Bolts) task which will resolve to the freshly created user.
-
getUser
public bolts.Task<User> getUser(android.net.Uri userUri)
-
loginUser
public bolts.Task<Session> loginUser(UserCredentials userCredentials)
Log-in the user which is identified with the given credentials.- Parameters:
userCredentials
- The user's credentials.- Returns:
- A (Bolts) task which will resolve to a session that can be used to do requests to the Gini API.
-
updateEmail
public bolts.Task<org.json.JSONObject> updateEmail(java.lang.String newEmail, java.lang.String oldEmail, Session giniAPISession)
Update the email of the logged in user.- Parameters:
newEmail
- A new email address.oldEmail
- The previous email address of the user.giniAPISession
- The session for the Gini API which was returned when the user was logged in.- Returns:
- A (Bolts) task which will resolve to an empty JSONObject.
-
getUserCenterSession
protected bolts.Task<Session> getUserCenterSession()
Returns a future that will resolve to a valid session (for the User Center API!).
-
loginClient
protected bolts.Task<Session> loginClient()
-
-