public static class

KinveyAuthRequest.Builder

extends Object
java.lang.Object
   ↳ com.kinvey.java.auth.KinveyAuthRequest.Builder

Class Overview

Used to construct a KinveyAuthRequest. The result will be an auth request that adjusts for the authentication scenario.

There are three scenarios that this builder will support for Kinvey authentication.

The first is where the user is known and the both the username and password have been provided.

      KinveyAuthResponse response = new KinveyAuthRequest.Builder(transport,jsonfactory,baseUrl, appKey,appSecret)
          .setUserIdAndPassword(userid, password)
          .build()
          .execute();
 

The second is where the user has established their identity with one of the supported 3rd party authentication systems like Facebook, LinkedInCredential, etc.

      KinveyAuthResponse response = new KinveyAuthRequest.Builder(transport,jsonfactory,baseUrl, appKey,appSecret)
              .setThirdPartyAuthToken(thirdpartytoken)
              .build()
              .execute();
 

The third and final way authentication can occur is with just the appKey and appSecret, in this case, an implicit user is created when the execute() is called.

      KinveyAuthResponse response = new KinveyAuthRequest.Builder(transport,jsonfactory,baseUrl, appKey,appSecret)
              .build()
              .execute();
 

Summary

Public Constructors
KinveyAuthRequest.Builder(HttpTransport transport, JsonFactory jsonFactory, String baseUrl, String appKey, String appSecret, GenericJson user)
KinveyAuthRequest.Builder(HttpTransport transport, JsonFactory jsonFactory, String baseUrl, String appKey, String appSecret, String username, String password, GenericJson user)
KinveyAuthRequest.Builder(HttpTransport transport, JsonFactory jsonFactory, String baseUrl, String appKey, String appSecret, ThirdPartyIdentity identity, GenericJson user)
Public Methods
KinveyAuthRequest build()
BasicAuthentication getAppKeyAuthentication()
String getBaseUrl()
JsonFactory getJsonFactory()
final String getPassword()
ThirdPartyIdentity getThirdPartyIdentity()
HttpTransport getTransport()
final String getUsername()
KinveyAuthRequest.Builder setCreate(boolean create)
void setPassword(String password)
KinveyAuthRequest.Builder setThirdPartyIdentity(ThirdPartyIdentity identity)
KinveyAuthRequest.Builder setUser(GenericJson user)
void setUsername(String username)
KinveyAuthRequest.Builder setUsernameAndPassword(String username, String password)
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public KinveyAuthRequest.Builder (HttpTransport transport, JsonFactory jsonFactory, String baseUrl, String appKey, String appSecret, GenericJson user)

public KinveyAuthRequest.Builder (HttpTransport transport, JsonFactory jsonFactory, String baseUrl, String appKey, String appSecret, String username, String password, GenericJson user)

public KinveyAuthRequest.Builder (HttpTransport transport, JsonFactory jsonFactory, String baseUrl, String appKey, String appSecret, ThirdPartyIdentity identity, GenericJson user)

Public Methods

public KinveyAuthRequest build ()

public BasicAuthentication getAppKeyAuthentication ()

Returns
  • appkey and appsecret RequestInitializer used to create the BasicAuthentication for the POST request

public String getBaseUrl ()

public JsonFactory getJsonFactory ()

Returns
  • json factory

public final String getPassword ()

Returns
  • password or null if none is set

public ThirdPartyIdentity getThirdPartyIdentity ()

public HttpTransport getTransport ()

Returns
  • the http trasport

public final String getUsername ()

Returns
  • username or null in none is set

public KinveyAuthRequest.Builder setCreate (boolean create)

public void setPassword (String password)

Parameters
password user provided password for the authentication request

public KinveyAuthRequest.Builder setThirdPartyIdentity (ThirdPartyIdentity identity)

public KinveyAuthRequest.Builder setUser (GenericJson user)

public void setUsername (String username)

Parameters
username uniquely identifies the user

public KinveyAuthRequest.Builder setUsernameAndPassword (String username, String password)