3030import com .auth0 .authentication .result .Delegation ;
3131import com .auth0 .authentication .result .UserProfile ;
3232import com .auth0 .internal .RequestFactory ;
33+ import com .auth0 .request .AuthenticationRequest ;
3334import com .auth0 .request .ParameterizableRequest ;
3435import com .auth0 .request .Request ;
3536import com .auth0 .util .Metrics ;
3940
4041import java .util .Map ;
4142
42- import static com .auth0 .authentication .ParameterBuilder .GRANT_TYPE_JWT ;
4343import static com .auth0 .authentication .ParameterBuilder .GRANT_TYPE_PASSWORD ;
4444
4545/**
@@ -142,7 +142,7 @@ public void setDefaultDbConnection(String defaultDbConnection) {
142142 * @param password of the user
143143 * @return a request to configure and start that will yield {@link Credentials}
144144 */
145- public ParameterizableRequest < Credentials > login (String usernameOrEmail , String password ) {
145+ public AuthenticationRequest login (String usernameOrEmail , String password ) {
146146 Map <String , Object > requestParameters = ParameterBuilder .newAuthenticationBuilder ()
147147 .set (USERNAME_KEY , usernameOrEmail )
148148 .set (PASSWORD_KEY , password )
@@ -158,7 +158,7 @@ public ParameterizableRequest<Credentials> login(String usernameOrEmail, String
158158 * @param connection that will be used to authenticate the user, e.g. 'facebook'
159159 * @return a request to configure and start that will yield {@link Credentials}
160160 */
161- public ParameterizableRequest < Credentials > loginWithOAuthAccessToken (String token , String connection ) {
161+ public AuthenticationRequest loginWithOAuthAccessToken (String token , String connection ) {
162162 HttpUrl url = HttpUrl .parse (auth0 .getDomainUrl ()).newBuilder ()
163163 .addPathSegment (OAUTH_PATH )
164164 .addPathSegment (ACCESS_TOKEN_PATH )
@@ -170,8 +170,8 @@ public ParameterizableRequest<Credentials> loginWithOAuthAccessToken(String toke
170170 .setAccessToken (token )
171171 .asDictionary ();
172172
173- return factory .POST (url , client , mapper , Credentials . class )
174- .addParameters (parameters );
173+ return factory .authenticationPOST (url , client , mapper )
174+ .addAuthenticationParameters (parameters );
175175 }
176176
177177 /**
@@ -181,7 +181,7 @@ public ParameterizableRequest<Credentials> loginWithOAuthAccessToken(String toke
181181 * @param verificationCode sent by Auth0 via SMS
182182 * @return a request to configure and start that will yield {@link Credentials}
183183 */
184- public ParameterizableRequest < Credentials > loginWithPhoneNumber (String phoneNumber , String verificationCode ) {
184+ public AuthenticationRequest loginWithPhoneNumber (String phoneNumber , String verificationCode ) {
185185 Map <String , Object > parameters = ParameterBuilder .newAuthenticationBuilder ()
186186 .set (USERNAME_KEY , phoneNumber )
187187 .set (PASSWORD_KEY , verificationCode )
@@ -199,7 +199,7 @@ public ParameterizableRequest<Credentials> loginWithPhoneNumber(String phoneNumb
199199 * @param verificationCode sent by Auth0 via Email
200200 * @return a request to configure and start that will yield {@link Credentials}
201201 */
202- public ParameterizableRequest < Credentials > loginWithEmail (String email , String verificationCode ) {
202+ public AuthenticationRequest loginWithEmail (String email , String verificationCode ) {
203203 Map <String , Object > parameters = ParameterBuilder .newAuthenticationBuilder ()
204204 .set (USERNAME_KEY , email )
205205 .set (PASSWORD_KEY , verificationCode )
@@ -268,7 +268,7 @@ public ParameterizableRequest<DatabaseUser> createUser(String email, String pass
268268 */
269269 public SignUpRequest signUp (String email , String password , String username ) {
270270 final ParameterizableRequest <DatabaseUser > createUserRequest = createUser (email , password , username );
271- final ParameterizableRequest < Credentials > authenticationRequest = login (email , password );
271+ final AuthenticationRequest authenticationRequest = login (email , password );
272272 return new SignUpRequest (createUserRequest , authenticationRequest );
273273 }
274274
@@ -282,7 +282,7 @@ public SignUpRequest signUp(String email, String password, String username) {
282282 */
283283 public SignUpRequest signUp (String email , String password ) {
284284 ParameterizableRequest <DatabaseUser > createUserRequest = createUser (email , password );
285- final ParameterizableRequest < Credentials > authenticationRequest = login (email , password );
285+ final AuthenticationRequest authenticationRequest = login (email , password );
286286 return new SignUpRequest (createUserRequest , authenticationRequest );
287287 }
288288
@@ -478,15 +478,15 @@ public ParameterizableRequest<Void> passwordless() {
478478 /**
479479 * Fetch the user's profile after it's authenticated by a login request.
480480 * If the login request fails, the returned request will fail
481- * @param loginRequest that will authenticate a user with Auth0 and return a {@see Credentials}
482- * @return a {@see AuthenticationRequest } that first logins and the fetches the profile
481+ * @param authenticationRequest that will authenticate a user with Auth0 and return a {@see Credentials}
482+ * @return a {@see ProfileRequest } that first logins and the fetches the profile
483483 */
484- public AuthenticationRequest getProfileAfter (ParameterizableRequest < Credentials > loginRequest ) {
484+ public ProfileRequest getProfileAfter (AuthenticationRequest authenticationRequest ) {
485485 final ParameterizableRequest <UserProfile > profileRequest = profileRequest ();
486- return new AuthenticationRequest ( loginRequest , profileRequest );
486+ return new ProfileRequest ( authenticationRequest , profileRequest );
487487 }
488488
489- protected ParameterizableRequest < Credentials > loginWithResourceOwner (Map <String , Object > parameters ) {
489+ protected AuthenticationRequest loginWithResourceOwner (Map <String , Object > parameters ) {
490490 HttpUrl url = HttpUrl .parse (auth0 .getDomainUrl ()).newBuilder ()
491491 .addPathSegment (OAUTH_PATH )
492492 .addPathSegment (RESOURCE_OWNER_PATH )
@@ -497,8 +497,8 @@ protected ParameterizableRequest<Credentials> loginWithResourceOwner(Map<String,
497497 .setConnection (defaultDbConnection )
498498 .addAll (parameters )
499499 .asDictionary ();
500- return factory .POST (url , client , mapper , Credentials . class )
501- .addParameters (requestParameters );
500+ return factory .authenticationPOST (url , client , mapper )
501+ .addAuthenticationParameters (requestParameters );
502502 }
503503
504504 private ParameterizableRequest <UserProfile > profileRequest () {
0 commit comments