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

Relax requirement for redirect_uri for back-channel OAuth flows #3076

Merged
merged 1 commit into from
Nov 24, 2022
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
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,38 @@ public void registerWithHttpFail(final String redirectUris) throws Exception {
assertNotNull(response.getErrorDescription());
}

@Test
public void registerGrantPasswordRedirectUriNull() {
showTitle("registerGrantPasswordRedirectUriNull");

RegisterRequest registerRequest = new RegisterRequest(ApplicationType.WEB, "Test client with grant password redirect uri null", null);
registerRequest.setGrantTypes(Collections.singletonList(RESOURCE_OWNER_PASSWORD_CREDENTIALS));
registerRequest.setResponseTypes(Collections.singletonList(CODE));

RegisterClient registerClient = new RegisterClient(registrationEndpoint);
registerClient.setRequest(registerRequest);
RegisterResponse response = registerClient.exec();

showClient(registerClient);
AssertBuilder.registerResponse(response).created().check();
}

@Test
public void registerGrantClientCredentialsRedirectUriEmpty() {
showTitle("registerGrantClientCredentialsRedirectUriEmpty");

RegisterRequest registerRequest = new RegisterRequest(ApplicationType.WEB, "Test client with grant client_credentials redirect uri empty", Collections.emptyList());
registerRequest.setGrantTypes(Collections.singletonList(CLIENT_CREDENTIALS));
registerRequest.setResponseTypes(Collections.singletonList(CODE));

RegisterClient registerClient = new RegisterClient(registrationEndpoint);
registerClient.setRequest(registerRequest);
RegisterResponse response = registerClient.exec();

showClient(registerClient);
AssertBuilder.registerResponse(response).created().check();
}

@Parameters({"redirectUris"})
@Test
public void deleteClient(final String redirectUris) throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,10 @@ public Pair<Boolean, String> validateParamsClientRegister(

if (grantTypes != null &&
(grantTypes.contains(GrantType.AUTHORIZATION_CODE) || grantTypes.contains(GrantType.IMPLICIT)
|| (responseTypes.contains(ResponseType.CODE) && !grantTypes.contains(GrantType.DEVICE_CODE))
|| (responseTypes.contains(ResponseType.CODE) && (
!grantTypes.contains(GrantType.DEVICE_CODE) &&
!grantTypes.contains(GrantType.RESOURCE_OWNER_PASSWORD_CREDENTIALS) &&
!grantTypes.contains(GrantType.CLIENT_CREDENTIALS)))
|| responseTypes.contains(ResponseType.TOKEN) || responseTypes.contains(ResponseType.ID_TOKEN))) {
if (redirectUris == null || redirectUris.isEmpty()) {
return new Pair<>(false, "Redirect uris are empty.");
Expand Down Expand Up @@ -284,7 +287,10 @@ public boolean validateRedirectUris(List<GrantType> grantTypes, List<ResponseTyp
}
}
} else valid = !grantTypes.contains(GrantType.AUTHORIZATION_CODE) && !grantTypes.contains(GrantType.IMPLICIT) &&
(!responseTypes.contains(ResponseType.CODE) || grantTypes.contains(GrantType.DEVICE_CODE))
(!responseTypes.contains(ResponseType.CODE) || (
grantTypes.contains(GrantType.DEVICE_CODE) ||
grantTypes.contains(GrantType.RESOURCE_OWNER_PASSWORD_CREDENTIALS) ||
grantTypes.contains(GrantType.CLIENT_CREDENTIALS)))
&& !responseTypes.contains(ResponseType.TOKEN) && !responseTypes.contains(ResponseType.ID_TOKEN);


Expand Down