fix utf-8 issue: change MimeTypeUtils.APPLICATION_JSON_VALUE to MediaType.APPLICATION_JSON_UTF8_VALUE
parent
e96f423163
commit
243c1bb609
|
@ -36,11 +36,11 @@ import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.security.core.Authentication;
|
import org.springframework.security.core.Authentication;
|
||||||
import org.springframework.security.oauth2.provider.OAuth2Authentication;
|
import org.springframework.security.oauth2.provider.OAuth2Authentication;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.Model;
|
import org.springframework.ui.Model;
|
||||||
import org.springframework.util.MimeTypeUtils;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMethod;
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
|
@ -78,7 +78,7 @@ public class AuthorizationRequestEndpoint {
|
||||||
@Autowired
|
@Autowired
|
||||||
private UmaTokenService umaTokenService;
|
private UmaTokenService umaTokenService;
|
||||||
|
|
||||||
@RequestMapping(method = RequestMethod.POST, consumes = MimeTypeUtils.APPLICATION_JSON_VALUE, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
|
@RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||||
public String authorizationRequest(@RequestBody String jsonString, Model m, Authentication auth) {
|
public String authorizationRequest(@RequestBody String jsonString, Model m, Authentication auth) {
|
||||||
|
|
||||||
AuthenticationUtilities.ensureOAuthScope(auth, SystemScopeService.UMA_AUTHORIZATION_SCOPE);
|
AuthenticationUtilities.ensureOAuthScope(auth, SystemScopeService.UMA_AUTHORIZATION_SCOPE);
|
||||||
|
|
|
@ -34,11 +34,11 @@ import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.security.core.Authentication;
|
import org.springframework.security.core.Authentication;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.Model;
|
import org.springframework.ui.Model;
|
||||||
import org.springframework.util.MimeTypeUtils;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMethod;
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
|
@ -72,7 +72,7 @@ public class PermissionRegistrationEndpoint {
|
||||||
|
|
||||||
private JsonParser parser = new JsonParser();
|
private JsonParser parser = new JsonParser();
|
||||||
|
|
||||||
@RequestMapping(method = RequestMethod.POST, consumes = MimeTypeUtils.APPLICATION_JSON_VALUE, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
|
@RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||||
public String getPermissionTicket(@RequestBody String jsonString, Model m, Authentication auth) {
|
public String getPermissionTicket(@RequestBody String jsonString, Model m, Authentication auth) {
|
||||||
|
|
||||||
ensureOAuthScope(auth, SystemScopeService.UMA_PROTECTION_SCOPE);
|
ensureOAuthScope(auth, SystemScopeService.UMA_PROTECTION_SCOPE);
|
||||||
|
|
|
@ -32,11 +32,11 @@ import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.security.core.Authentication;
|
import org.springframework.security.core.Authentication;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.Model;
|
import org.springframework.ui.Model;
|
||||||
import org.springframework.util.MimeTypeUtils;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
@ -73,7 +73,7 @@ public class PolicyAPI {
|
||||||
* @param auth
|
* @param auth
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@RequestMapping(value = "", method = RequestMethod.GET, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
|
@RequestMapping(value = "", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||||
public String getResourceSetsForCurrentUser(Model m, Authentication auth) {
|
public String getResourceSetsForCurrentUser(Model m, Authentication auth) {
|
||||||
|
|
||||||
Collection<ResourceSet> resourceSets = resourceSetService.getAllForOwner(auth.getName());
|
Collection<ResourceSet> resourceSets = resourceSetService.getAllForOwner(auth.getName());
|
||||||
|
@ -90,7 +90,7 @@ public class PolicyAPI {
|
||||||
* @param auth
|
* @param auth
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@RequestMapping(value = "/{rsid}", method = RequestMethod.GET, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
|
@RequestMapping(value = "/{rsid}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||||
public String getResourceSet(@PathVariable (value = "rsid") Long rsid, Model m, Authentication auth) {
|
public String getResourceSet(@PathVariable (value = "rsid") Long rsid, Model m, Authentication auth) {
|
||||||
|
|
||||||
ResourceSet rs = resourceSetService.getById(rsid);
|
ResourceSet rs = resourceSetService.getById(rsid);
|
||||||
|
@ -120,7 +120,7 @@ public class PolicyAPI {
|
||||||
* @param auth
|
* @param auth
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@RequestMapping(value = "/{rsid}", method = RequestMethod.DELETE, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
|
@RequestMapping(value = "/{rsid}", method = RequestMethod.DELETE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||||
public String deleteResourceSet(@PathVariable (value = "rsid") Long rsid, Model m, Authentication auth) {
|
public String deleteResourceSet(@PathVariable (value = "rsid") Long rsid, Model m, Authentication auth) {
|
||||||
|
|
||||||
ResourceSet rs = resourceSetService.getById(rsid);
|
ResourceSet rs = resourceSetService.getById(rsid);
|
||||||
|
@ -151,7 +151,7 @@ public class PolicyAPI {
|
||||||
* @param auth
|
* @param auth
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@RequestMapping(value = "/{rsid}" + POLICYURL, method = RequestMethod.GET, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
|
@RequestMapping(value = "/{rsid}" + POLICYURL, method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||||
public String getPoliciesForResourceSet(@PathVariable (value = "rsid") Long rsid, Model m, Authentication auth) {
|
public String getPoliciesForResourceSet(@PathVariable (value = "rsid") Long rsid, Model m, Authentication auth) {
|
||||||
|
|
||||||
ResourceSet rs = resourceSetService.getById(rsid);
|
ResourceSet rs = resourceSetService.getById(rsid);
|
||||||
|
@ -181,7 +181,7 @@ public class PolicyAPI {
|
||||||
* @param auth
|
* @param auth
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@RequestMapping(value = "/{rsid}" + POLICYURL, method = RequestMethod.POST, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
|
@RequestMapping(value = "/{rsid}" + POLICYURL, method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||||
public String createNewPolicyForResourceSet(@PathVariable (value = "rsid") Long rsid, @RequestBody String jsonString, Model m, Authentication auth) {
|
public String createNewPolicyForResourceSet(@PathVariable (value = "rsid") Long rsid, @RequestBody String jsonString, Model m, Authentication auth) {
|
||||||
ResourceSet rs = resourceSetService.getById(rsid);
|
ResourceSet rs = resourceSetService.getById(rsid);
|
||||||
|
|
||||||
|
@ -240,7 +240,7 @@ public class PolicyAPI {
|
||||||
* @param auth
|
* @param auth
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@RequestMapping(value = "/{rsid}" + POLICYURL + "/{pid}", method = RequestMethod.GET, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
|
@RequestMapping(value = "/{rsid}" + POLICYURL + "/{pid}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||||
public String getPolicy(@PathVariable (value = "rsid") Long rsid, @PathVariable (value = "pid") Long pid, Model m, Authentication auth) {
|
public String getPolicy(@PathVariable (value = "rsid") Long rsid, @PathVariable (value = "pid") Long pid, Model m, Authentication auth) {
|
||||||
|
|
||||||
ResourceSet rs = resourceSetService.getById(rsid);
|
ResourceSet rs = resourceSetService.getById(rsid);
|
||||||
|
@ -280,7 +280,7 @@ public class PolicyAPI {
|
||||||
* @param auth
|
* @param auth
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@RequestMapping(value = "/{rsid}" + POLICYURL + "/{pid}", method = RequestMethod.PUT, consumes = MimeTypeUtils.APPLICATION_JSON_VALUE, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
|
@RequestMapping(value = "/{rsid}" + POLICYURL + "/{pid}", method = RequestMethod.PUT, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||||
public String setClaimsForResourceSet(@PathVariable (value = "rsid") Long rsid, @PathVariable (value = "pid") Long pid, @RequestBody String jsonString, Model m, Authentication auth) {
|
public String setClaimsForResourceSet(@PathVariable (value = "rsid") Long rsid, @PathVariable (value = "pid") Long pid, @RequestBody String jsonString, Model m, Authentication auth) {
|
||||||
|
|
||||||
ResourceSet rs = resourceSetService.getById(rsid);
|
ResourceSet rs = resourceSetService.getById(rsid);
|
||||||
|
@ -350,7 +350,7 @@ public class PolicyAPI {
|
||||||
* @param auth
|
* @param auth
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@RequestMapping(value = "/{rsid}" + POLICYURL + "/{pid}", method = RequestMethod.DELETE, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
|
@RequestMapping(value = "/{rsid}" + POLICYURL + "/{pid}", method = RequestMethod.DELETE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||||
public String deleteResourceSet(@PathVariable ("rsid") Long rsid, @PathVariable (value = "pid") Long pid, Model m, Authentication auth) {
|
public String deleteResourceSet(@PathVariable ("rsid") Long rsid, @PathVariable (value = "pid") Long pid, Model m, Authentication auth) {
|
||||||
|
|
||||||
ResourceSet rs = resourceSetService.getById(rsid);
|
ResourceSet rs = resourceSetService.getById(rsid);
|
||||||
|
|
|
@ -40,12 +40,12 @@ import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.security.core.Authentication;
|
import org.springframework.security.core.Authentication;
|
||||||
import org.springframework.security.oauth2.provider.OAuth2Authentication;
|
import org.springframework.security.oauth2.provider.OAuth2Authentication;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.Model;
|
import org.springframework.ui.Model;
|
||||||
import org.springframework.util.MimeTypeUtils;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
@ -78,7 +78,7 @@ public class ResourceSetRegistrationEndpoint {
|
||||||
|
|
||||||
private JsonParser parser = new JsonParser();
|
private JsonParser parser = new JsonParser();
|
||||||
|
|
||||||
@RequestMapping(method = RequestMethod.POST, produces = MimeTypeUtils.APPLICATION_JSON_VALUE, consumes = MimeTypeUtils.APPLICATION_JSON_VALUE)
|
@RequestMapping(method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||||
public String createResourceSet(@RequestBody String jsonString, Model m, Authentication auth) {
|
public String createResourceSet(@RequestBody String jsonString, Model m, Authentication auth) {
|
||||||
ensureOAuthScope(auth, SystemScopeService.UMA_PROTECTION_SCOPE);
|
ensureOAuthScope(auth, SystemScopeService.UMA_PROTECTION_SCOPE);
|
||||||
|
|
||||||
|
@ -127,7 +127,7 @@ public class ResourceSetRegistrationEndpoint {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = "/{id}", method = RequestMethod.GET, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
|
@RequestMapping(value = "/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||||
public String readResourceSet(@PathVariable ("id") Long id, Model m, Authentication auth) {
|
public String readResourceSet(@PathVariable ("id") Long id, Model m, Authentication auth) {
|
||||||
ensureOAuthScope(auth, SystemScopeService.UMA_PROTECTION_SCOPE);
|
ensureOAuthScope(auth, SystemScopeService.UMA_PROTECTION_SCOPE);
|
||||||
|
|
||||||
|
@ -157,7 +157,7 @@ public class ResourceSetRegistrationEndpoint {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = "/{id}", method = RequestMethod.PUT, consumes = MimeTypeUtils.APPLICATION_JSON_VALUE, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
|
@RequestMapping(value = "/{id}", method = RequestMethod.PUT, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||||
public String updateResourceSet(@PathVariable ("id") Long id, @RequestBody String jsonString, Model m, Authentication auth) {
|
public String updateResourceSet(@PathVariable ("id") Long id, @RequestBody String jsonString, Model m, Authentication auth) {
|
||||||
ensureOAuthScope(auth, SystemScopeService.UMA_PROTECTION_SCOPE);
|
ensureOAuthScope(auth, SystemScopeService.UMA_PROTECTION_SCOPE);
|
||||||
|
|
||||||
|
@ -202,7 +202,7 @@ public class ResourceSetRegistrationEndpoint {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
|
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||||
public String deleteResourceSet(@PathVariable ("id") Long id, Model m, Authentication auth) {
|
public String deleteResourceSet(@PathVariable ("id") Long id, Model m, Authentication auth) {
|
||||||
ensureOAuthScope(auth, SystemScopeService.UMA_PROTECTION_SCOPE);
|
ensureOAuthScope(auth, SystemScopeService.UMA_PROTECTION_SCOPE);
|
||||||
|
|
||||||
|
@ -240,7 +240,7 @@ public class ResourceSetRegistrationEndpoint {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(method = RequestMethod.GET, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
|
@RequestMapping(method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||||
public String listResourceSets(Model m, Authentication auth) {
|
public String listResourceSets(Model m, Authentication auth) {
|
||||||
ensureOAuthScope(auth, SystemScopeService.UMA_PROTECTION_SCOPE);
|
ensureOAuthScope(auth, SystemScopeService.UMA_PROTECTION_SCOPE);
|
||||||
|
|
||||||
|
|
|
@ -32,11 +32,11 @@ import org.mitre.openid.connect.view.JsonErrorView;
|
||||||
import org.mitre.openid.connect.web.RootController;
|
import org.mitre.openid.connect.web.RootController;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.security.core.Authentication;
|
import org.springframework.security.core.Authentication;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.Model;
|
import org.springframework.ui.Model;
|
||||||
import org.springframework.util.MimeTypeUtils;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMethod;
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
@ -64,7 +64,7 @@ public class UserClaimSearchHelper {
|
||||||
private ConfigurationPropertiesBean config;
|
private ConfigurationPropertiesBean config;
|
||||||
|
|
||||||
|
|
||||||
@RequestMapping(method = RequestMethod.GET, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
|
@RequestMapping(method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
||||||
public String search(@RequestParam(value = "identifier") String email, Model m, Authentication auth, HttpServletRequest req) {
|
public String search(@RequestParam(value = "identifier") String email, Model m, Authentication auth, HttpServletRequest req) {
|
||||||
|
|
||||||
// check locally first
|
// check locally first
|
||||||
|
|
Loading…
Reference in New Issue