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

pull/306/merge
Justin Richer 2013-03-04 16:12:06 -05:00
parent 26f03ec070
commit 23efdf9f51
2 changed files with 9 additions and 4 deletions

View File

@ -32,7 +32,7 @@ import com.google.gson.reflect.TypeToken;
* @author jricher * @author jricher
* *
*/ */
@Component("clientInformationResponse") @Component("clientInformationResponseView")
public class ClientInformationResponseView extends AbstractView { public class ClientInformationResponseView extends AbstractView {
// note that this won't serialize nulls by default // 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("client_secret", c.getClientSecret());
o.addProperty("expires_at", 0); // TODO: do we want to let secrets expire? 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()); o.addProperty("registration_access_token", token.getValue());

View File

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