Determined that init binder was not needed to fix default for Boolean require_auth_time; instead use defaultValue=\"true\" in the RequestParam declaration. Also fixed bug in ClientDetails service so that it will not blow up if the client has no redirect uris registered

pull/263/head
Amanda Anganes 2012-11-21 15:39:07 -05:00
parent 2084639828
commit cf1ddf0457
2 changed files with 8 additions and 32 deletions

View File

@ -71,11 +71,13 @@ public class DefaultOAuth2ClientDetailsEntityService implements ClientDetailsEnt
throw new IllegalArgumentException("Tried to save a new client with an existing ID: " + client.getId()); throw new IllegalArgumentException("Tried to save a new client with an existing ID: " + client.getId());
} }
for (String uri : client.getRegisteredRedirectUri()) { if (client.getRegisteredRedirectUri() != null) {
if (blacklistedSiteService.isBlacklisted(uri)) { for (String uri : client.getRegisteredRedirectUri()) {
throw new IllegalArgumentException("Client URI is blacklisted: " + uri); if (blacklistedSiteService.isBlacklisted(uri)) {
} throw new IllegalArgumentException("Client URI is blacklisted: " + uri);
} }
}
}
// assign a random clientid if it's empty // assign a random clientid if it's empty
// NOTE: don't assign a random client secret without asking, since public clients have no secret // NOTE: don't assign a random client secret without asking, since public clients have no secret

View File

@ -168,32 +168,6 @@ public class ClientDynamicRegistrationEndpoint {
} }
}); });
} }
//TODO: this is a stub, make it work
@InitBinder({"require_auth_time"})
public void authTimeInitBinder(WebDataBinder binder) {
/*
* Space-separated set of strings
*/
binder.registerCustomEditor(Boolean.class, new PropertyEditorSupport() {
@Override
public void setAsText(String text) throws IllegalArgumentException {
if (Strings.isNullOrEmpty(text)) {
setValue(false);
} else {
setValue(new Boolean(text));
}
}
@Override
public String getAsText() {
Boolean bool = (Boolean) getValue();
return bool == null? "false" : bool.toString();
}
});
}
@RequestMapping(params = "type=client_associate", produces = "application/json") @RequestMapping(params = "type=client_associate", produces = "application/json")
public String clientAssociate( public String clientAssociate(
@ -225,7 +199,7 @@ public class ClientDynamicRegistrationEndpoint {
*/ */
@RequestParam(value = "default_max_age", required = false) Integer defaultMaxAge, @RequestParam(value = "default_max_age", required = false) Integer defaultMaxAge,
@RequestParam(value = "require_auth_time", required = false) Boolean requireAuthTime, @RequestParam(value = "require_auth_time", required = false, defaultValue = "true") Boolean requireAuthTime,
@RequestParam(value = "default_acr", required = false) String defaultAcr, @RequestParam(value = "default_acr", required = false) String defaultAcr,
ModelMap model ModelMap model
) { ) {