List of usage examples for org.springframework.security.oauth2.common.util OAuth2Utils SCOPE_PREFIX
String SCOPE_PREFIX
To view the source code for org.springframework.security.oauth2.common.util OAuth2Utils SCOPE_PREFIX.
Click Source Link
From source file:org.energyos.espi.datacustodian.oauth.AccessConfirmationController.java
@RequestMapping("/oauth/confirm_access") public ModelAndView getAccessConfirmation(Map<String, Object> model, Principal principal) throws Exception { AuthorizationRequest clientAuth = (AuthorizationRequest) model.remove("authorizationRequest"); ClientDetails client = clientDetailsService.loadClientByClientId(clientAuth.getClientId()); model.put("auth_request", clientAuth); model.put("client", client); Map<String, String> scopes = new LinkedHashMap<String, String>(); for (String scope : clientAuth.getScope()) { scopes.put(OAuth2Utils.SCOPE_PREFIX + scope, "false"); //Spring Security OAuth2 2.0.0.M2 change }/*from ww w. j a v a 2 s .com*/ for (Approval approval : approvalStore.getApprovals(principal.getName(), client.getClientId())) { if (clientAuth.getScope().contains(approval.getScope())) { scopes.put(OAuth2Utils.SCOPE_PREFIX + approval.getScope(), approval.getStatus() == ApprovalStatus.APPROVED ? "true" : "false"); } } model.put("scopes", scopes); return new ModelAndView("access_confirmation", model); }
From source file:org.springframework.security.oauth2.provider.approval.ApprovalStoreUserApprovalHandler.java
@Override public Map<String, Object> getUserApprovalRequest(AuthorizationRequest authorizationRequest, Authentication userAuthentication) { Map<String, Object> model = new HashMap<String, Object>(); model.putAll(authorizationRequest.getRequestParameters()); Map<String, String> scopes = new LinkedHashMap<String, String>(); for (String scope : authorizationRequest.getScope()) { scopes.put(OAuth2Utils.SCOPE_PREFIX + scope, "false"); }/*from w ww.j av a 2s . c om*/ for (Approval approval : approvalStore.getApprovals(userAuthentication.getName(), authorizationRequest.getClientId())) { if (authorizationRequest.getScope().contains(approval.getScope())) { scopes.put(OAuth2Utils.SCOPE_PREFIX + approval.getScope(), approval.getStatus() == ApprovalStatus.APPROVED ? "true" : "false"); } } model.put("scopes", scopes); return model; }