Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change default WebAuthProvider connection to null #33

Merged
merged 1 commit into from
Oct 14, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
change default WebAuthProvider connection to null
  • Loading branch information
lbalmaceda committed Oct 14, 2016
commit 7672810989879bd70fb7d467714404fd0ff0e171
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