From a4fc4e939ea3c1d95148ca1c64a3751bcff66da1 Mon Sep 17 00:00:00 2001 From: Michael Jett Date: Tue, 15 May 2012 12:41:41 -0400 Subject: [PATCH] ClientAPI cleanup --- .../mitre/openid/connect/web/ClientAPI.java | 98 ++----------------- .../src/main/webapp/resources/js/app.js | 4 +- 2 files changed, 9 insertions(+), 93 deletions(-) diff --git a/openid-connect-server/src/main/java/org/mitre/openid/connect/web/ClientAPI.java b/openid-connect-server/src/main/java/org/mitre/openid/connect/web/ClientAPI.java index 3ce191c69..67e141d23 100644 --- a/openid-connect-server/src/main/java/org/mitre/openid/connect/web/ClientAPI.java +++ b/openid-connect-server/src/main/java/org/mitre/openid/connect/web/ClientAPI.java @@ -20,8 +20,7 @@ import org.mitre.oauth2.service.ClientDetailsEntityService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.*; import org.springframework.web.servlet.ModelAndView; import java.util.Collection; @@ -45,7 +44,7 @@ public class ClientAPI { } @PreAuthorize("hasRole('ROLE_ADMIN')") - @RequestMapping("") + @RequestMapping(method = RequestMethod.GET, headers="application/json") public ModelAndView apiGetAllClients(ModelAndView modelAndView) { Collection clients = clientService.getAllClients(); @@ -55,94 +54,11 @@ public class ClientAPI { return modelAndView; } -/* - */ -/** - * - * @param modelAndView - * @param clientId - * @param clientSecret - * @param scope - * @param grantTypes - * @param redirectUri - * @param authorities - * @param name - * @param description - * @param allowRefresh - * @param accessTokenTimeout - * @param refreshTokenTimeout - * @param owner - * @return - *//* - - @PreAuthorize("hasRole('ROLE_ADMIN')") - @RequestMapping("/add") - public ModelAndView apiAddClient(ModelAndView modelAndView, - @RequestParam String clientId, @RequestParam String clientSecret, - @RequestParam String scope, // space delimited - @RequestParam String grantTypes, // space delimited - @RequestParam(required = false) String redirectUri, - @RequestParam String authorities, // space delimited - @RequestParam(required = false) String name, - @RequestParam(required = false) String description, - @RequestParam(required = false, defaultValue = "false") boolean allowRefresh, - @RequestParam(required = false) Long accessTokenTimeout, - @RequestParam(required = false) Long refreshTokenTimeout, - @RequestParam(required = false) String owner - ) { - return null; - } - - */ -/** - * - * @param modelAndView - * @param clientId - * @return - *//* - - @PreAuthorize("hasRole('ROLE_ADMIN')") - @RequestMapping("/delete") - public ModelAndView apiDeleteClient(ModelAndView modelAndView, - @RequestParam String clientId) { + @RequestMapping(method = RequestMethod.POST, headers="application/json") + @ResponseBody + public ClientDetailsEntity addClient(@RequestBody ClientDetailsEntity c) { + /*ClientDetailsEntity created = clientService.createClient() + return created;*/ return null; } -*/ - - - - /* *//** - * - * @param modelAndView - * @param clientId - * @param clientSecret - * @param scope - * @param grantTypes - * @param redirectUri - * @param authorities - * @param name - * @param description - * @param allowRefresh - * @param accessTokenTimeout - * @param refreshTokenTimeout - * @param owner - * @return - *//* - @PreAuthorize("hasRole('ROLE_ADMIN')") - @RequestMapping("/update") - public ModelAndView apiUpdateClient(ModelAndView modelAndView, - @RequestParam String clientId, @RequestParam String clientSecret, - @RequestParam String scope, // space delimited - @RequestParam String grantTypes, // space delimited - @RequestParam(required = false) String redirectUri, - @RequestParam String authorities, // space delimited - @RequestParam(required = false) String name, - @RequestParam(required = false) String description, - @RequestParam(required = false, defaultValue = "false") boolean allowRefresh, - @RequestParam(required = false) Long accessTokenTimeout, - @RequestParam(required = false) Long refreshTokenTimeout, - @RequestParam(required = false) String owner - ) { - return null; - }*/ } diff --git a/openid-connect-server/src/main/webapp/resources/js/app.js b/openid-connect-server/src/main/webapp/resources/js/app.js index cd6cf1f85..283dc20db 100644 --- a/openid-connect-server/src/main/webapp/resources/js/app.js +++ b/openid-connect-server/src/main/webapp/resources/js/app.js @@ -13,13 +13,13 @@ refreshTokens:false }, - urlRoot:"/resources/test/json/clients.js" + urlRoot:"/api/clients" }); var ClientCollection = Backbone.Collection.extend({ model:ClientModel, - url:"/resources/test/json/clients.js" + url:"/api/clients" });