Skip to content

Commit

Permalink
change default WebAuthProvider connection to null
Browse files Browse the repository at this point in the history
  • Loading branch information
lbalmaceda committed Oct 14, 2016
1 parent ac63ac2 commit 7672810
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 11 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -351,8 +351,6 @@ WebAuthProvider.init(account)
.start(MainActivity.this, authCallback, WEB_REQ_CODE);
```

> The default connection used is `Username-Password-Authentication`
#### Use Code grant with PKCE
> Before you can use `Code Grant` in Android, make sure to go to your [client's section](https://manage.auth0.com/#/applications) in dashboard and check in the Settings that `Client Type` is `Native`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ public class WebAuthProvider {

private static final String TAG = WebAuthProvider.class.getName();

private static final String DEFAULT_CONNECTION_NAME = "Username-Password-Authentication";

private static final String KEY_ERROR = "error";
private static final String KEY_ID_TOKEN = "id_token";
private static final String KEY_ACCESS_TOKEN = "access_token";
Expand Down Expand Up @@ -121,7 +119,6 @@ public static class Builder {
this.parameters = new HashMap<>();
this.state = UUID.randomUUID().toString();
this.scope = SCOPE_TYPE_OPENID;
this.connectionName = DEFAULT_CONNECTION_NAME;
}

/**
Expand Down Expand Up @@ -210,7 +207,7 @@ public Builder withParameters(@Nullable Map<String, Object> parameters) {
}

/**
* Use the given connection instead of the default 'auth0'.
* Use the given connection. By default no connection is specified, so the hosted login page will be displayed.
*
* @param connectionName to use
* @return the current builder instance
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ public class WebAuthProviderTest {
private static final String SCOPE = "scope";
private static final String CONNECTION_SCOPE = "connection_scope";
private static final String STATE = "state";
private static final String USERNAME_PASSWORD_AUTHENTICATION_CONNECTION = "Username-Password-Authentication";
private static final String SCOPE_OPEN_ID = "openid";

@Mock
Expand Down Expand Up @@ -120,7 +119,7 @@ public void shouldHaveDefaultsOnInit() throws Exception {
assertThat(instance.useBrowser(), is(true));
assertThat(instance.useCodeGrant(), is(true));
assertThat(instance.useFullscreen(), is(false));
assertThat(instance.getConnection(), is(not(Matchers.isEmptyOrNullString())));
assertThat(instance.getConnection(), is(nullValue()));
assertThat(instance.getScope(), is(not(Matchers.isEmptyOrNullString())));
assertThat(instance.getConnectionScope(), is(nullValue()));
assertThat(instance.getState(), is(not(Matchers.isEmptyOrNullString())));
Expand All @@ -129,12 +128,12 @@ public void shouldHaveDefaultsOnInit() throws Exception {
}

@Test
public void shouldHaveDefaultConnection() throws Exception {
public void shouldNotHaveDefaultConnection() throws Exception {
WebAuthProvider.init(account)
.start(activity, callback, REQUEST_CODE);

final WebAuthProvider instance = WebAuthProvider.getInstance();
assertThat(instance.getConnection(), is(USERNAME_PASSWORD_AUTHENTICATION_CONNECTION));
assertThat(instance.getConnection(), is(nullValue()));
}

@Test
Expand Down Expand Up @@ -262,7 +261,7 @@ public void shouldStartWithWebViewAndDefaultConnection() throws Exception {
final ComponentName expComponent = new ComponentName("package", WebAuthActivity.class.getName());
assertThat(intentCaptor.getValue(), is(notNullValue()));
assertThat(intentCaptor.getValue(), hasComponent(expComponent));
assertThat(intentCaptor.getValue(), hasExtra(WebAuthActivity.CONNECTION_NAME_EXTRA, "Username-Password-Authentication"));
assertThat(intentCaptor.getValue(), hasExtra(WebAuthActivity.CONNECTION_NAME_EXTRA, null));
assertThat(intentCaptor.getValue(), hasExtra(WebAuthActivity.FULLSCREEN_EXTRA, false));
}

Expand Down

0 comments on commit 7672810

Please sign in to comment.