Code example for AccessControlException

0
                // make sure they're not trying to 
                // update private information. 
                return; 
            } 
        } 
        throw new AccessControlException("You do not have the required permissions.");
    } 
 
    private void performClientChecks(OAuth2Authentication oAuth2Authentication, ScopePathType requiredScope, OrcidMessage orcidMessage, String orcid) {
        AuthorizationRequest authorizationRequest = oAuth2Authentication.getAuthorizationRequest();
        // If we have an ORCID in the request, we assume that this is intended 
        // as an update 
        if (orcidMessage != null && orcidMessage.getOrcidProfile() != null && StringUtils.isNotBlank(orcid)) {
 
            OrcidIdentifier orcidOb = orcidMessage.getOrcidProfile().getOrcidIdentifier();
            String messageOrcid = orcidOb != null ? orcidOb.getPath() : orcid;
            if (StringUtils.isNotBlank(messageOrcid) && !orcid.equals(messageOrcid)) {
                throw new IllegalArgumentException("The ORCID in the body and the URI do NOT match. Body ORCID: " + messageOrcid + " URI ORCID: " + orcid
                        + " do NOT match."); 
            }