@@ -0,0 +1,3268 @@
+/*%0A * Copyright (c) 2020, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.%0A *%0A * WSO2 Inc. licenses this file to you under the Apache License,%0A * Version 2.0 (the %22License%22); you may not use this file except%0A * in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A * http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing,%0A * software distributed under the License is distributed on an%0A * %22AS IS%22 BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY%0A * KIND, either express or implied.  See the License for the%0A * specific language governing permissions and limitations%0A * under the License.%0A */%0A%0Apackage org.wso2.carbon.identity.oauth2.validators.scope;%0A%0Aimport org.wso2.carbon.identity.oauth2.IdentityOAuth2Exception;%0Aimport org.wso2.carbon.identity.oauth2.authz.OAuthAuthzReqMessageContext;%0Aimport org.wso2.carbon.identity.oauth2.token.OAuthTokenReqMessageContext;%0Aimport org.wso2.carbon.identity.oauth2.validators.OAuth2TokenValidationMessageContext;%0A%0A/**%0A * This is a global level interface for scope validation. This needs to be engaged after application level validators.%0A */%0Apublic interface ScopeValidator %7B%0A%0A    /**%0A     * Checks whether the validator can be engaged.%0A     *%0A     * @return True if it can handle, otherwise false.%0A     */%0A    boolean canHandle();%0A%0A    /**%0A     * Validates scopes in the authorization  request and manipulate the permitted scopes within the request. Engage%0A     * it after application-level validators at ResponseTypeHandler level.%0A     *%0A     * @param authzReqMessageContext Authorization request.%0A     * @return True if the user has enough permission to generate tokens or authorization codes with requested%0A     * scopes or no scopes are requested, otherwise false.%0A     * @throws IdentityOAuth2Exception%0A     */%0A    boolean validateScope(OAuthAuthzReqMessageContext authzReqMessageContext) throws IdentityOAuth2Exception;%0A%0A    /**%0A     * Validates scopes in the token request and manipulate the permitted scopes within the request. Engage it after%0A     * application-level validators at GrantHandler level.%0A     *%0A     * @param tokenReqMessageContext OAuthTokenReqMessageContext.%0A     * @return True if the user has enough permission to generate tokens with requested scopes or%0A     * no scopes are requested, otherwise false.%0A     * @throws IdentityOAuth2Exception%0A     */%0A    boolean validateScope(OAuthTokenReqMessageContext tokenReqMessageContext) throws IdentityOAuth2Exception;%0A%0A    /**%0A     * Validates scopes in the token request and manipulate the permitted scopes within the request. Engage it after%0A     * application-level validators at TokenValidator level.%0A     *%0A     * @param tokenValidationMessageContext OAuth2TokenValidationMessageContext.%0A     * @return True if the user has enough permission to generate tokens with requested scopes or%0A     * no scopes are requested, otherwise false.%0A     * @throws IdentityOAuth2Exception%0A     */%0A    boolean validateScope(OAuth2TokenValidationMessageContext tokenValidationMessageContext)%0A            throws IdentityOAuth2Exception;%0A%0A    /**%0A     * Get the friendly name of the implemented scope validator.%0A     *%0A     * @return Name of the scope validator.%0A     */%0A    String getName();%0A%7D%0A

Add Global scope validator api