fix utf-8 issue: change MediaType.APPLICATION_JSON_VALUE to MediaType.APPLICATION_JSON_UTF8_VALUE
parent
a2e8cb1a67
commit
e96f423163
|
@ -53,7 +53,7 @@ public class JWKSetView extends AbstractView {
|
||||||
@Override
|
@Override
|
||||||
protected void renderMergedOutputModel(Map<String, Object> model, HttpServletRequest request, HttpServletResponse response) {
|
protected void renderMergedOutputModel(Map<String, Object> model, HttpServletRequest request, HttpServletResponse response) {
|
||||||
|
|
||||||
response.setContentType(MediaType.APPLICATION_JSON_VALUE);
|
response.setContentType(MediaType.APPLICATION_JSON_UTF8_VALUE);
|
||||||
|
|
||||||
|
|
||||||
//BiMap<String, PublicKey> keyMap = (BiMap<String, PublicKey>) model.get("keys");
|
//BiMap<String, PublicKey> keyMap = (BiMap<String, PublicKey>) model.get("keys");
|
||||||
|
|
|
@ -105,7 +105,7 @@ public class DiscoveryEndpoint {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@RequestMapping(value={"/" + WEBFINGER_URL}, produces = MediaType.APPLICATION_JSON_VALUE)
|
@RequestMapping(value={"/" + WEBFINGER_URL}, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||||
public String webfinger(@RequestParam("resource") String resource, @RequestParam(value = "rel", required = false) String rel, Model model) {
|
public String webfinger(@RequestParam("resource") String resource, @RequestParam(value = "rel", required = false) String rel, Model model) {
|
||||||
|
|
||||||
if (!Strings.isNullOrEmpty(rel) && !rel.equals("http://openid.net/specs/connect/1.0/issuer")) {
|
if (!Strings.isNullOrEmpty(rel) && !rel.equals("http://openid.net/specs/connect/1.0/issuer")) {
|
||||||
|
|
|
@ -124,7 +124,7 @@ public class TokenApiView extends AbstractView {
|
||||||
@Override
|
@Override
|
||||||
protected void renderMergedOutputModel(Map<String, Object> model, HttpServletRequest request, HttpServletResponse response) {
|
protected void renderMergedOutputModel(Map<String, Object> model, HttpServletRequest request, HttpServletResponse response) {
|
||||||
|
|
||||||
response.setContentType(MediaType.APPLICATION_JSON_VALUE);
|
response.setContentType(MediaType.APPLICATION_JSON_UTF8_VALUE);
|
||||||
|
|
||||||
|
|
||||||
HttpStatus code = (HttpStatus) model.get(HttpCodeView.CODE);
|
HttpStatus code = (HttpStatus) model.get(HttpCodeView.CODE);
|
||||||
|
|
|
@ -94,7 +94,7 @@ public class DeviceEndpoint {
|
||||||
@Autowired
|
@Autowired
|
||||||
private OAuth2RequestFactory oAuth2RequestFactory;
|
private OAuth2RequestFactory oAuth2RequestFactory;
|
||||||
|
|
||||||
@RequestMapping(value = "/" + URL, method = RequestMethod.POST, consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
@RequestMapping(value = "/" + URL, method = RequestMethod.POST, consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||||
public String requestDeviceCode(@RequestParam("client_id") String clientId, @RequestParam(name="scope", required=false) String scope, Map<String, String> parameters, ModelMap model) {
|
public String requestDeviceCode(@RequestParam("client_id") String clientId, @RequestParam(name="scope", required=false) String scope, Map<String, String> parameters, ModelMap model) {
|
||||||
|
|
||||||
ClientDetailsEntity client;
|
ClientDetailsEntity client;
|
||||||
|
|
|
@ -64,7 +64,7 @@ public class ScopeAPI {
|
||||||
|
|
||||||
private Gson gson = new Gson();
|
private Gson gson = new Gson();
|
||||||
|
|
||||||
@RequestMapping(value = "", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
@RequestMapping(value = "", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||||
public String getAll(ModelMap m) {
|
public String getAll(ModelMap m) {
|
||||||
|
|
||||||
Set<SystemScope> allScopes = scopeService.getAll();
|
Set<SystemScope> allScopes = scopeService.getAll();
|
||||||
|
@ -74,7 +74,7 @@ public class ScopeAPI {
|
||||||
return JsonEntityView.VIEWNAME;
|
return JsonEntityView.VIEWNAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = "/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
@RequestMapping(value = "/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||||
public String getScope(@PathVariable("id") Long id, ModelMap m) {
|
public String getScope(@PathVariable("id") Long id, ModelMap m) {
|
||||||
|
|
||||||
SystemScope scope = scopeService.getById(id);
|
SystemScope scope = scopeService.getById(id);
|
||||||
|
@ -95,7 +95,7 @@ public class ScopeAPI {
|
||||||
}
|
}
|
||||||
|
|
||||||
@PreAuthorize("hasRole('ROLE_ADMIN')")
|
@PreAuthorize("hasRole('ROLE_ADMIN')")
|
||||||
@RequestMapping(value = "/{id}", method = RequestMethod.PUT, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
@RequestMapping(value = "/{id}", method = RequestMethod.PUT, produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||||
public String updateScope(@PathVariable("id") Long id, @RequestBody String json, ModelMap m) {
|
public String updateScope(@PathVariable("id") Long id, @RequestBody String json, ModelMap m) {
|
||||||
|
|
||||||
SystemScope existing = scopeService.getById(id);
|
SystemScope existing = scopeService.getById(id);
|
||||||
|
@ -133,7 +133,7 @@ public class ScopeAPI {
|
||||||
}
|
}
|
||||||
|
|
||||||
@PreAuthorize("hasRole('ROLE_ADMIN')")
|
@PreAuthorize("hasRole('ROLE_ADMIN')")
|
||||||
@RequestMapping(value = "", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
@RequestMapping(value = "", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||||
public String createScope(@RequestBody String json, ModelMap m) {
|
public String createScope(@RequestBody String json, ModelMap m) {
|
||||||
SystemScope scope = gson.fromJson(json, SystemScope.class);
|
SystemScope scope = gson.fromJson(json, SystemScope.class);
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,7 @@ public class TokenAPI {
|
||||||
*/
|
*/
|
||||||
private static final Logger logger = LoggerFactory.getLogger(TokenAPI.class);
|
private static final Logger logger = LoggerFactory.getLogger(TokenAPI.class);
|
||||||
|
|
||||||
@RequestMapping(value = "/access", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
@RequestMapping(value = "/access", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||||
public String getAllAccessTokens(ModelMap m, Principal p) {
|
public String getAllAccessTokens(ModelMap m, Principal p) {
|
||||||
|
|
||||||
Set<OAuth2AccessTokenEntity> allTokens = tokenService.getAllAccessTokensForUser(p.getName());
|
Set<OAuth2AccessTokenEntity> allTokens = tokenService.getAllAccessTokensForUser(p.getName());
|
||||||
|
@ -78,7 +78,7 @@ public class TokenAPI {
|
||||||
return TokenApiView.VIEWNAME;
|
return TokenApiView.VIEWNAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = "/access/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
@RequestMapping(value = "/access/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||||
public String getAccessTokenById(@PathVariable("id") Long id, ModelMap m, Principal p) {
|
public String getAccessTokenById(@PathVariable("id") Long id, ModelMap m, Principal p) {
|
||||||
|
|
||||||
OAuth2AccessTokenEntity token = tokenService.getAccessTokenById(id);
|
OAuth2AccessTokenEntity token = tokenService.getAccessTokenById(id);
|
||||||
|
@ -99,7 +99,7 @@ public class TokenAPI {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = "/access/{id}", method = RequestMethod.DELETE, produces = MediaType.APPLICATION_JSON_VALUE)
|
@RequestMapping(value = "/access/{id}", method = RequestMethod.DELETE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||||
public String deleteAccessTokenById(@PathVariable("id") Long id, ModelMap m, Principal p) {
|
public String deleteAccessTokenById(@PathVariable("id") Long id, ModelMap m, Principal p) {
|
||||||
|
|
||||||
OAuth2AccessTokenEntity token = tokenService.getAccessTokenById(id);
|
OAuth2AccessTokenEntity token = tokenService.getAccessTokenById(id);
|
||||||
|
@ -122,7 +122,7 @@ public class TokenAPI {
|
||||||
}
|
}
|
||||||
|
|
||||||
@PreAuthorize("hasRole('ROLE_ADMIN')")
|
@PreAuthorize("hasRole('ROLE_ADMIN')")
|
||||||
@RequestMapping(value = "/client/{clientId}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
@RequestMapping(value = "/client/{clientId}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||||
public String getAccessTokensByClientId(@PathVariable("clientId") String clientId, ModelMap m, Principal p) {
|
public String getAccessTokensByClientId(@PathVariable("clientId") String clientId, ModelMap m, Principal p) {
|
||||||
|
|
||||||
ClientDetailsEntity client = clientService.loadClientByClientId(clientId);
|
ClientDetailsEntity client = clientService.loadClientByClientId(clientId);
|
||||||
|
@ -141,7 +141,7 @@ public class TokenAPI {
|
||||||
}
|
}
|
||||||
|
|
||||||
@PreAuthorize("hasRole('ROLE_ADMIN')")
|
@PreAuthorize("hasRole('ROLE_ADMIN')")
|
||||||
@RequestMapping(value = "/registration/{clientId}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
@RequestMapping(value = "/registration/{clientId}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||||
public String getRegistrationTokenByClientId(@PathVariable("clientId") String clientId, ModelMap m, Principal p) {
|
public String getRegistrationTokenByClientId(@PathVariable("clientId") String clientId, ModelMap m, Principal p) {
|
||||||
|
|
||||||
ClientDetailsEntity client = clientService.loadClientByClientId(clientId);
|
ClientDetailsEntity client = clientService.loadClientByClientId(clientId);
|
||||||
|
@ -166,7 +166,7 @@ public class TokenAPI {
|
||||||
}
|
}
|
||||||
|
|
||||||
@PreAuthorize("hasRole('ROLE_ADMIN')")
|
@PreAuthorize("hasRole('ROLE_ADMIN')")
|
||||||
@RequestMapping(value = "/registration/{clientId}", method = RequestMethod.PUT, produces = MediaType.APPLICATION_JSON_VALUE)
|
@RequestMapping(value = "/registration/{clientId}", method = RequestMethod.PUT, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||||
public String rotateRegistrationTokenByClientId(@PathVariable("clientId") String clientId, ModelMap m, Principal p) {
|
public String rotateRegistrationTokenByClientId(@PathVariable("clientId") String clientId, ModelMap m, Principal p) {
|
||||||
ClientDetailsEntity client = clientService.loadClientByClientId(clientId);
|
ClientDetailsEntity client = clientService.loadClientByClientId(clientId);
|
||||||
|
|
||||||
|
@ -191,7 +191,7 @@ public class TokenAPI {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = "/refresh", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
@RequestMapping(value = "/refresh", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||||
public String getAllRefreshTokens(ModelMap m, Principal p) {
|
public String getAllRefreshTokens(ModelMap m, Principal p) {
|
||||||
|
|
||||||
Set<OAuth2RefreshTokenEntity> allTokens = tokenService.getAllRefreshTokensForUser(p.getName());
|
Set<OAuth2RefreshTokenEntity> allTokens = tokenService.getAllRefreshTokensForUser(p.getName());
|
||||||
|
@ -201,7 +201,7 @@ public class TokenAPI {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = "/refresh/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
@RequestMapping(value = "/refresh/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||||
public String getRefreshTokenById(@PathVariable("id") Long id, ModelMap m, Principal p) {
|
public String getRefreshTokenById(@PathVariable("id") Long id, ModelMap m, Principal p) {
|
||||||
|
|
||||||
OAuth2RefreshTokenEntity token = tokenService.getRefreshTokenById(id);
|
OAuth2RefreshTokenEntity token = tokenService.getRefreshTokenById(id);
|
||||||
|
@ -222,7 +222,7 @@ public class TokenAPI {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = "/refresh/{id}", method = RequestMethod.DELETE, produces = MediaType.APPLICATION_JSON_VALUE)
|
@RequestMapping(value = "/refresh/{id}", method = RequestMethod.DELETE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||||
public String deleteRefreshTokenById(@PathVariable("id") Long id, ModelMap m, Principal p) {
|
public String deleteRefreshTokenById(@PathVariable("id") Long id, ModelMap m, Principal p) {
|
||||||
|
|
||||||
OAuth2RefreshTokenEntity token = tokenService.getRefreshTokenById(id);
|
OAuth2RefreshTokenEntity token = tokenService.getRefreshTokenById(id);
|
||||||
|
|
|
@ -144,7 +144,7 @@ public abstract class AbstractClientEntityView extends AbstractView {
|
||||||
@Override
|
@Override
|
||||||
protected void renderMergedOutputModel(Map<String, Object> model, HttpServletRequest request, HttpServletResponse response) {
|
protected void renderMergedOutputModel(Map<String, Object> model, HttpServletRequest request, HttpServletResponse response) {
|
||||||
|
|
||||||
response.setContentType(MediaType.APPLICATION_JSON_VALUE);
|
response.setContentType(MediaType.APPLICATION_JSON_UTF8_VALUE);
|
||||||
|
|
||||||
|
|
||||||
HttpStatus code = (HttpStatus) model.get(HttpCodeView.CODE);
|
HttpStatus code = (HttpStatus) model.get(HttpCodeView.CODE);
|
||||||
|
|
|
@ -67,7 +67,7 @@ public class ClientInformationResponseView extends AbstractView {
|
||||||
@Override
|
@Override
|
||||||
protected void renderMergedOutputModel(Map<String, Object> model, HttpServletRequest request, HttpServletResponse response) {
|
protected void renderMergedOutputModel(Map<String, Object> model, HttpServletRequest request, HttpServletResponse response) {
|
||||||
|
|
||||||
response.setContentType(MediaType.APPLICATION_JSON_VALUE);
|
response.setContentType(MediaType.APPLICATION_JSON_UTF8_VALUE);
|
||||||
|
|
||||||
RegisteredClient c = (RegisteredClient) model.get("client");
|
RegisteredClient c = (RegisteredClient) model.get("client");
|
||||||
//OAuth2AccessTokenEntity token = (OAuth2AccessTokenEntity) model.get("token");
|
//OAuth2AccessTokenEntity token = (OAuth2AccessTokenEntity) model.get("token");
|
||||||
|
|
|
@ -100,7 +100,7 @@ public class JsonApprovedSiteView extends AbstractView {
|
||||||
@Override
|
@Override
|
||||||
protected void renderMergedOutputModel(Map<String, Object> model, HttpServletRequest request, HttpServletResponse response) {
|
protected void renderMergedOutputModel(Map<String, Object> model, HttpServletRequest request, HttpServletResponse response) {
|
||||||
|
|
||||||
response.setContentType(MediaType.APPLICATION_JSON_VALUE);
|
response.setContentType(MediaType.APPLICATION_JSON_UTF8_VALUE);
|
||||||
|
|
||||||
|
|
||||||
HttpStatus code = (HttpStatus) model.get(HttpCodeView.CODE);
|
HttpStatus code = (HttpStatus) model.get(HttpCodeView.CODE);
|
||||||
|
|
|
@ -82,8 +82,7 @@ public class JsonEntityView extends AbstractView {
|
||||||
@Override
|
@Override
|
||||||
protected void renderMergedOutputModel(Map<String, Object> model, HttpServletRequest request, HttpServletResponse response) {
|
protected void renderMergedOutputModel(Map<String, Object> model, HttpServletRequest request, HttpServletResponse response) {
|
||||||
|
|
||||||
response.setContentType(MediaType.APPLICATION_JSON_VALUE);
|
response.setContentType(MediaType.APPLICATION_JSON_UTF8_VALUE);
|
||||||
response.setCharacterEncoding("UTF-8");
|
|
||||||
|
|
||||||
|
|
||||||
HttpStatus code = (HttpStatus) model.get(HttpCodeView.CODE);
|
HttpStatus code = (HttpStatus) model.get(HttpCodeView.CODE);
|
||||||
|
|
|
@ -89,7 +89,7 @@ public class JsonErrorView extends AbstractView {
|
||||||
@Override
|
@Override
|
||||||
protected void renderMergedOutputModel(Map<String, Object> model, HttpServletRequest request, HttpServletResponse response) {
|
protected void renderMergedOutputModel(Map<String, Object> model, HttpServletRequest request, HttpServletResponse response) {
|
||||||
|
|
||||||
response.setContentType(MediaType.APPLICATION_JSON_VALUE);
|
response.setContentType(MediaType.APPLICATION_JSON_UTF8_VALUE);
|
||||||
|
|
||||||
|
|
||||||
HttpStatus code = (HttpStatus) model.get(HttpCodeView.CODE);
|
HttpStatus code = (HttpStatus) model.get(HttpCodeView.CODE);
|
||||||
|
|
|
@ -99,8 +99,7 @@ public class UserInfoView extends AbstractView {
|
||||||
|
|
||||||
Set<String> scope = (Set<String>) model.get(SCOPE);
|
Set<String> scope = (Set<String>) model.get(SCOPE);
|
||||||
|
|
||||||
response.setContentType(MediaType.APPLICATION_JSON_VALUE);
|
response.setContentType(MediaType.APPLICATION_JSON_UTF8_VALUE);
|
||||||
response.setCharacterEncoding("UTF-8");
|
|
||||||
|
|
||||||
|
|
||||||
JsonObject authorizedClaims = null;
|
JsonObject authorizedClaims = null;
|
||||||
|
|
|
@ -65,7 +65,7 @@ public class ApprovedSiteAPI {
|
||||||
* @param m
|
* @param m
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@RequestMapping(method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
@RequestMapping(method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||||
public String getAllApprovedSites(ModelMap m, Principal p) {
|
public String getAllApprovedSites(ModelMap m, Principal p) {
|
||||||
|
|
||||||
Collection<ApprovedSite> all = approvedSiteService.getByUserId(p.getName());
|
Collection<ApprovedSite> all = approvedSiteService.getByUserId(p.getName());
|
||||||
|
@ -105,7 +105,7 @@ public class ApprovedSiteAPI {
|
||||||
/**
|
/**
|
||||||
* Get a single approved site
|
* Get a single approved site
|
||||||
*/
|
*/
|
||||||
@RequestMapping(value="/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
@RequestMapping(value="/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||||
public String getApprovedSite(@PathVariable("id") Long id, ModelMap m, Principal p) {
|
public String getApprovedSite(@PathVariable("id") Long id, ModelMap m, Principal p) {
|
||||||
ApprovedSite approvedSite = approvedSiteService.getById(id);
|
ApprovedSite approvedSite = approvedSiteService.getById(id);
|
||||||
if (approvedSite == null) {
|
if (approvedSite == null) {
|
||||||
|
|
|
@ -73,7 +73,7 @@ public class BlacklistAPI {
|
||||||
* @param m
|
* @param m
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@RequestMapping(method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
@RequestMapping(method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||||
public String getAllBlacklistedSites(ModelMap m) {
|
public String getAllBlacklistedSites(ModelMap m) {
|
||||||
|
|
||||||
Collection<BlacklistedSite> all = blacklistService.getAll();
|
Collection<BlacklistedSite> all = blacklistService.getAll();
|
||||||
|
@ -90,7 +90,7 @@ public class BlacklistAPI {
|
||||||
* @param p
|
* @param p
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
@RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||||
public String addNewBlacklistedSite(@RequestBody String jsonString, ModelMap m, Principal p) {
|
public String addNewBlacklistedSite(@RequestBody String jsonString, ModelMap m, Principal p) {
|
||||||
|
|
||||||
JsonObject json;
|
JsonObject json;
|
||||||
|
@ -124,7 +124,7 @@ public class BlacklistAPI {
|
||||||
/**
|
/**
|
||||||
* Update an existing blacklisted site
|
* Update an existing blacklisted site
|
||||||
*/
|
*/
|
||||||
@RequestMapping(value="/{id}", method = RequestMethod.PUT, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
@RequestMapping(value="/{id}", method = RequestMethod.PUT, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||||
public String updateBlacklistedSite(@PathVariable("id") Long id, @RequestBody String jsonString, ModelMap m, Principal p) {
|
public String updateBlacklistedSite(@PathVariable("id") Long id, @RequestBody String jsonString, ModelMap m, Principal p) {
|
||||||
|
|
||||||
JsonObject json;
|
JsonObject json;
|
||||||
|
@ -190,7 +190,7 @@ public class BlacklistAPI {
|
||||||
/**
|
/**
|
||||||
* Get a single blacklisted site
|
* Get a single blacklisted site
|
||||||
*/
|
*/
|
||||||
@RequestMapping(value="/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
@RequestMapping(value="/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||||
public String getBlacklistedSite(@PathVariable("id") Long id, ModelMap m) {
|
public String getBlacklistedSite(@PathVariable("id") Long id, ModelMap m) {
|
||||||
BlacklistedSite blacklist = blacklistService.getById(id);
|
BlacklistedSite blacklist = blacklistService.getById(id);
|
||||||
if (blacklist == null) {
|
if (blacklist == null) {
|
||||||
|
|
|
@ -225,7 +225,7 @@ public class ClientAPI {
|
||||||
* @param modelAndView
|
* @param modelAndView
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@RequestMapping(method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
@RequestMapping(method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||||
public String apiGetAllClients(Model model, Authentication auth) {
|
public String apiGetAllClients(Model model, Authentication auth) {
|
||||||
|
|
||||||
Collection<ClientDetailsEntity> clients = clientService.getAllClients();
|
Collection<ClientDetailsEntity> clients = clientService.getAllClients();
|
||||||
|
@ -246,7 +246,7 @@ public class ClientAPI {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("hasRole('ROLE_ADMIN')")
|
@PreAuthorize("hasRole('ROLE_ADMIN')")
|
||||||
@RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
@RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||||
public String apiAddClient(@RequestBody String jsonString, Model m, Authentication auth) {
|
public String apiAddClient(@RequestBody String jsonString, Model m, Authentication auth) {
|
||||||
|
|
||||||
JsonObject json = null;
|
JsonObject json = null;
|
||||||
|
@ -356,7 +356,7 @@ public class ClientAPI {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("hasRole('ROLE_ADMIN')")
|
@PreAuthorize("hasRole('ROLE_ADMIN')")
|
||||||
@RequestMapping(value="/{id}", method = RequestMethod.PUT, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
@RequestMapping(value="/{id}", method = RequestMethod.PUT, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||||
public String apiUpdateClient(@PathVariable("id") Long id, @RequestBody String jsonString, Model m, Authentication auth) {
|
public String apiUpdateClient(@PathVariable("id") Long id, @RequestBody String jsonString, Model m, Authentication auth) {
|
||||||
|
|
||||||
JsonObject json = null;
|
JsonObject json = null;
|
||||||
|
@ -485,7 +485,7 @@ public class ClientAPI {
|
||||||
* @param modelAndView
|
* @param modelAndView
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@RequestMapping(value="/{id}", method=RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
@RequestMapping(value="/{id}", method=RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||||
public String apiShowClient(@PathVariable("id") Long id, Model model, Authentication auth) {
|
public String apiShowClient(@PathVariable("id") Long id, Model model, Authentication auth) {
|
||||||
|
|
||||||
ClientDetailsEntity client = clientService.getClientById(id);
|
ClientDetailsEntity client = clientService.getClientById(id);
|
||||||
|
|
|
@ -80,7 +80,7 @@ public class DataAPI {
|
||||||
@Autowired
|
@Autowired
|
||||||
private MITREidDataService_1_3 exporter;
|
private MITREidDataService_1_3 exporter;
|
||||||
|
|
||||||
@RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
|
@RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||||
public String importData(Reader in, Model m) throws IOException {
|
public String importData(Reader in, Model m) throws IOException {
|
||||||
|
|
||||||
JsonReader reader = new JsonReader(in);
|
JsonReader reader = new JsonReader(in);
|
||||||
|
@ -120,10 +120,10 @@ public class DataAPI {
|
||||||
return "httpCodeView";
|
return "httpCodeView";
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
@RequestMapping(method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||||
public void exportData(HttpServletResponse resp, Principal prin) throws IOException {
|
public void exportData(HttpServletResponse resp, Principal prin) throws IOException {
|
||||||
|
|
||||||
resp.setContentType(MediaType.APPLICATION_JSON_VALUE);
|
resp.setContentType(MediaType.APPLICATION_JSON_UTF8_VALUE);
|
||||||
|
|
||||||
// this writer puts things out onto the wire
|
// this writer puts things out onto the wire
|
||||||
JsonWriter writer = new JsonWriter(resp.getWriter());
|
JsonWriter writer = new JsonWriter(resp.getWriter());
|
||||||
|
|
|
@ -150,7 +150,7 @@ public class DynamicClientRegistrationEndpoint {
|
||||||
* @param p
|
* @param p
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
@RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||||
public String registerNewClient(@RequestBody String jsonString, Model m) {
|
public String registerNewClient(@RequestBody String jsonString, Model m) {
|
||||||
|
|
||||||
ClientDetailsEntity newClient = null;
|
ClientDetailsEntity newClient = null;
|
||||||
|
@ -277,7 +277,7 @@ public class DynamicClientRegistrationEndpoint {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("hasRole('ROLE_CLIENT') and #oauth2.hasScope('" + SystemScopeService.REGISTRATION_TOKEN_SCOPE + "')")
|
@PreAuthorize("hasRole('ROLE_CLIENT') and #oauth2.hasScope('" + SystemScopeService.REGISTRATION_TOKEN_SCOPE + "')")
|
||||||
@RequestMapping(value = "/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
@RequestMapping(value = "/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||||
public String readClientConfiguration(@PathVariable("id") String clientId, Model m, OAuth2Authentication auth) {
|
public String readClientConfiguration(@PathVariable("id") String clientId, Model m, OAuth2Authentication auth) {
|
||||||
|
|
||||||
ClientDetailsEntity client = clientService.loadClientByClientId(clientId);
|
ClientDetailsEntity client = clientService.loadClientByClientId(clientId);
|
||||||
|
@ -318,7 +318,7 @@ public class DynamicClientRegistrationEndpoint {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("hasRole('ROLE_CLIENT') and #oauth2.hasScope('" + SystemScopeService.REGISTRATION_TOKEN_SCOPE + "')")
|
@PreAuthorize("hasRole('ROLE_CLIENT') and #oauth2.hasScope('" + SystemScopeService.REGISTRATION_TOKEN_SCOPE + "')")
|
||||||
@RequestMapping(value = "/{id}", method = RequestMethod.PUT, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
@RequestMapping(value = "/{id}", method = RequestMethod.PUT, produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||||
public String updateClient(@PathVariable("id") String clientId, @RequestBody String jsonString, Model m, OAuth2Authentication auth) {
|
public String updateClient(@PathVariable("id") String clientId, @RequestBody String jsonString, Model m, OAuth2Authentication auth) {
|
||||||
|
|
||||||
|
|
||||||
|
@ -413,7 +413,7 @@ public class DynamicClientRegistrationEndpoint {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("hasRole('ROLE_CLIENT') and #oauth2.hasScope('" + SystemScopeService.REGISTRATION_TOKEN_SCOPE + "')")
|
@PreAuthorize("hasRole('ROLE_CLIENT') and #oauth2.hasScope('" + SystemScopeService.REGISTRATION_TOKEN_SCOPE + "')")
|
||||||
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE, produces = MediaType.APPLICATION_JSON_VALUE)
|
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||||
public String deleteClient(@PathVariable("id") String clientId, Model m, OAuth2Authentication auth) {
|
public String deleteClient(@PathVariable("id") String clientId, Model m, OAuth2Authentication auth) {
|
||||||
|
|
||||||
ClientDetailsEntity client = clientService.loadClientByClientId(clientId);
|
ClientDetailsEntity client = clientService.loadClientByClientId(clientId);
|
||||||
|
|
|
@ -37,7 +37,7 @@ public class JWKSetPublishingEndpoint {
|
||||||
@Autowired
|
@Autowired
|
||||||
private JWTSigningAndValidationService jwtService;
|
private JWTSigningAndValidationService jwtService;
|
||||||
|
|
||||||
@RequestMapping(value = "/" + URL, produces = MediaType.APPLICATION_JSON_VALUE)
|
@RequestMapping(value = "/" + URL, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||||
public String getJwk(Model m) {
|
public String getJwk(Model m) {
|
||||||
|
|
||||||
// map from key id to key
|
// map from key id to key
|
||||||
|
|
|
@ -91,7 +91,7 @@ public class ProtectedResourceRegistrationEndpoint {
|
||||||
* @param p
|
* @param p
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
@RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||||
public String registerNewProtectedResource(@RequestBody String jsonString, Model m) {
|
public String registerNewProtectedResource(@RequestBody String jsonString, Model m) {
|
||||||
|
|
||||||
ClientDetailsEntity newClient = null;
|
ClientDetailsEntity newClient = null;
|
||||||
|
@ -225,7 +225,7 @@ public class ProtectedResourceRegistrationEndpoint {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("hasRole('ROLE_CLIENT') and #oauth2.hasScope('" + SystemScopeService.RESOURCE_TOKEN_SCOPE + "')")
|
@PreAuthorize("hasRole('ROLE_CLIENT') and #oauth2.hasScope('" + SystemScopeService.RESOURCE_TOKEN_SCOPE + "')")
|
||||||
@RequestMapping(value = "/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
@RequestMapping(value = "/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||||
public String readResourceConfiguration(@PathVariable("id") String clientId, Model m, OAuth2Authentication auth) {
|
public String readResourceConfiguration(@PathVariable("id") String clientId, Model m, OAuth2Authentication auth) {
|
||||||
|
|
||||||
ClientDetailsEntity client = clientService.loadClientByClientId(clientId);
|
ClientDetailsEntity client = clientService.loadClientByClientId(clientId);
|
||||||
|
@ -269,7 +269,7 @@ public class ProtectedResourceRegistrationEndpoint {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("hasRole('ROLE_CLIENT') and #oauth2.hasScope('" + SystemScopeService.RESOURCE_TOKEN_SCOPE + "')")
|
@PreAuthorize("hasRole('ROLE_CLIENT') and #oauth2.hasScope('" + SystemScopeService.RESOURCE_TOKEN_SCOPE + "')")
|
||||||
@RequestMapping(value = "/{id}", method = RequestMethod.PUT, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
@RequestMapping(value = "/{id}", method = RequestMethod.PUT, produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||||
public String updateProtectedResource(@PathVariable("id") String clientId, @RequestBody String jsonString, Model m, OAuth2Authentication auth) {
|
public String updateProtectedResource(@PathVariable("id") String clientId, @RequestBody String jsonString, Model m, OAuth2Authentication auth) {
|
||||||
|
|
||||||
|
|
||||||
|
@ -388,7 +388,7 @@ public class ProtectedResourceRegistrationEndpoint {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("hasRole('ROLE_CLIENT') and #oauth2.hasScope('" + SystemScopeService.RESOURCE_TOKEN_SCOPE + "')")
|
@PreAuthorize("hasRole('ROLE_CLIENT') and #oauth2.hasScope('" + SystemScopeService.RESOURCE_TOKEN_SCOPE + "')")
|
||||||
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE, produces = MediaType.APPLICATION_JSON_VALUE)
|
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||||
public String deleteResource(@PathVariable("id") String clientId, Model m, OAuth2Authentication auth) {
|
public String deleteResource(@PathVariable("id") String clientId, Model m, OAuth2Authentication auth) {
|
||||||
|
|
||||||
ClientDetailsEntity client = clientService.loadClientByClientId(clientId);
|
ClientDetailsEntity client = clientService.loadClientByClientId(clientId);
|
||||||
|
|
|
@ -44,7 +44,7 @@ public class StatsAPI {
|
||||||
@Autowired
|
@Autowired
|
||||||
private StatsService statsService;
|
private StatsService statsService;
|
||||||
|
|
||||||
@RequestMapping(value = "summary", produces = MediaType.APPLICATION_JSON_VALUE)
|
@RequestMapping(value = "summary", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||||
public String statsSummary(ModelMap m) {
|
public String statsSummary(ModelMap m) {
|
||||||
|
|
||||||
Map<String, Integer> e = statsService.getSummaryStats();
|
Map<String, Integer> e = statsService.getSummaryStats();
|
||||||
|
@ -56,7 +56,7 @@ public class StatsAPI {
|
||||||
}
|
}
|
||||||
|
|
||||||
// @PreAuthorize("hasRole('ROLE_USER')")
|
// @PreAuthorize("hasRole('ROLE_USER')")
|
||||||
// @RequestMapping(value = "byclientid", produces = MediaType.APPLICATION_JSON_VALUE)
|
// @RequestMapping(value = "byclientid", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||||
// public String statsByClient(ModelMap m) {
|
// public String statsByClient(ModelMap m) {
|
||||||
// Map<Long, Integer> e = statsService.getByClientId();
|
// Map<Long, Integer> e = statsService.getByClientId();
|
||||||
//
|
//
|
||||||
|
@ -66,7 +66,7 @@ public class StatsAPI {
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
@PreAuthorize("hasRole('ROLE_USER')")
|
@PreAuthorize("hasRole('ROLE_USER')")
|
||||||
@RequestMapping(value = "byclientid/{id}", produces = MediaType.APPLICATION_JSON_VALUE)
|
@RequestMapping(value = "byclientid/{id}", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||||
public String statsByClientId(@PathVariable("id") String clientId, ModelMap m) {
|
public String statsByClientId(@PathVariable("id") String clientId, ModelMap m) {
|
||||||
ClientStat e = statsService.getCountForClientId(clientId);
|
ClientStat e = statsService.getCountForClientId(clientId);
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,7 @@ public class UserInfoEndpoint {
|
||||||
* Get information about the user as specified in the accessToken included in this request
|
* Get information about the user as specified in the accessToken included in this request
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("hasRole('ROLE_USER') and #oauth2.hasScope('" + SystemScopeService.OPENID_SCOPE + "')")
|
@PreAuthorize("hasRole('ROLE_USER') and #oauth2.hasScope('" + SystemScopeService.OPENID_SCOPE + "')")
|
||||||
@RequestMapping(method= {RequestMethod.GET, RequestMethod.POST}, produces = {MediaType.APPLICATION_JSON_VALUE, UserInfoJWTView.JOSE_MEDIA_TYPE_VALUE})
|
@RequestMapping(method= {RequestMethod.GET, RequestMethod.POST}, produces = {MediaType.APPLICATION_JSON_UTF8_VALUE, UserInfoJWTView.JOSE_MEDIA_TYPE_VALUE})
|
||||||
public String getInfo(@RequestParam(value="claims", required=false) String claimsRequestJsonString,
|
public String getInfo(@RequestParam(value="claims", required=false) String claimsRequestJsonString,
|
||||||
@RequestHeader(value=HttpHeaders.ACCEPT, required=false) String acceptHeader,
|
@RequestHeader(value=HttpHeaders.ACCEPT, required=false) String acceptHeader,
|
||||||
OAuth2Authentication auth, Model model) {
|
OAuth2Authentication auth, Model model) {
|
||||||
|
|
|
@ -73,7 +73,7 @@ public class WhitelistAPI {
|
||||||
* @param m
|
* @param m
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@RequestMapping(method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
@RequestMapping(method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||||
public String getAllWhitelistedSites(ModelMap m) {
|
public String getAllWhitelistedSites(ModelMap m) {
|
||||||
|
|
||||||
Collection<WhitelistedSite> all = whitelistService.getAll();
|
Collection<WhitelistedSite> all = whitelistService.getAll();
|
||||||
|
@ -91,7 +91,7 @@ public class WhitelistAPI {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("hasRole('ROLE_ADMIN')")
|
@PreAuthorize("hasRole('ROLE_ADMIN')")
|
||||||
@RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
@RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||||
public String addNewWhitelistedSite(@RequestBody String jsonString, ModelMap m, Principal p) {
|
public String addNewWhitelistedSite(@RequestBody String jsonString, ModelMap m, Principal p) {
|
||||||
|
|
||||||
JsonObject json;
|
JsonObject json;
|
||||||
|
@ -128,7 +128,7 @@ public class WhitelistAPI {
|
||||||
* Update an existing whitelisted site
|
* Update an existing whitelisted site
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("hasRole('ROLE_ADMIN')")
|
@PreAuthorize("hasRole('ROLE_ADMIN')")
|
||||||
@RequestMapping(value="/{id}", method = RequestMethod.PUT, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
@RequestMapping(value="/{id}", method = RequestMethod.PUT, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||||
public String updateWhitelistedSite(@PathVariable("id") Long id, @RequestBody String jsonString, ModelMap m, Principal p) {
|
public String updateWhitelistedSite(@PathVariable("id") Long id, @RequestBody String jsonString, ModelMap m, Principal p) {
|
||||||
|
|
||||||
JsonObject json;
|
JsonObject json;
|
||||||
|
@ -192,7 +192,7 @@ public class WhitelistAPI {
|
||||||
/**
|
/**
|
||||||
* Get a single whitelisted site
|
* Get a single whitelisted site
|
||||||
*/
|
*/
|
||||||
@RequestMapping(value="/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
@RequestMapping(value="/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||||
public String getWhitelistedSite(@PathVariable("id") Long id, ModelMap m) {
|
public String getWhitelistedSite(@PathVariable("id") Long id, ModelMap m) {
|
||||||
WhitelistedSite whitelist = whitelistService.getById(id);
|
WhitelistedSite whitelist = whitelistService.getById(id);
|
||||||
if (whitelist == null) {
|
if (whitelist == null) {
|
||||||
|
|
Loading…
Reference in New Issue