fix viewbean name, nullsafe client creation time, fixed default scope handling

pull/306/merge
Justin Richer 12 years ago
parent 26f03ec070
commit 23efdf9f51

@ -32,7 +32,7 @@ import com.google.gson.reflect.TypeToken;
* @author jricher
*
*/
@Component("clientInformationResponse")
@Component("clientInformationResponseView")
public class ClientInformationResponseView extends AbstractView {
// note that this won't serialize nulls by default
@ -60,7 +60,10 @@ public class ClientInformationResponseView extends AbstractView {
o.addProperty("client_secret", c.getClientSecret());
o.addProperty("expires_at", 0); // TODO: do we want to let secrets expire?
}
o.addProperty("issued_at", c.getCreatedAt().getTime());
if (c.getCreatedAt() != null) {
o.addProperty("issued_at", c.getCreatedAt().getTime());
}
o.addProperty("registration_access_token", token.getValue());

@ -77,7 +77,9 @@ public class ClientDynamicRegistrationEndpoint {
// scopes that the client is asking for
Set<SystemScope> requestedScopes = scopeService.fromStrings(newClient.getScope());
if (requestedScopes == null) {
// if the client didn't ask for any, give them the defaults
if (requestedScopes == null || requestedScopes.isEmpty()) {
requestedScopes = scopeService.getDefaults();
}
@ -131,7 +133,7 @@ public class ClientDynamicRegistrationEndpoint {
m.addAttribute("code", HttpStatus.CREATED); // http 201
m.addAttribute("token", token);
return "clientInformationView";
return "clientInformationResponseView";
} else {
// didn't parse, this is a bad request

Loading…
Cancel
Save