/*
 *  Copyright WSO2 Inc.
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */

package org.wso2.carbon.apimgt.keymgt.handlers;

import org.wso2.carbon.apimgt.keymgt.ScopesIssuer;
import org.wso2.carbon.identity.oauth2.IdentityOAuth2Exception;
import org.wso2.carbon.identity.oauth2.dto.OAuth2AccessTokenRespDTO;
import org.wso2.carbon.identity.oauth2.token.OAuthTokenReqMessageContext;
import org.wso2.carbon.identity.oauth2.token.handlers.grant.AuthorizationCodeGrantHandler;

public class ExtendedAuthorizationCodeGrantHandler extends AuthorizationCodeGrantHandler {

    @Override
    public boolean validateGrant(OAuthTokenReqMessageContext tokReqMsgCtx) throws IdentityOAuth2Exception {
        return super.validateGrant(tokReqMsgCtx);
    }

    @Override
    public OAuth2AccessTokenRespDTO issue(OAuthTokenReqMessageContext tokReqMsgCtx)
            throws IdentityOAuth2Exception {
        return super.issue(tokReqMsgCtx);
    }

    @Override
    public boolean authorizeAccessDelegation(OAuthTokenReqMessageContext tokReqMsgCtx)
            throws IdentityOAuth2Exception {
        return super.authorizeAccessDelegation(tokReqMsgCtx);
    }

    @Override
    public boolean validateScope(OAuthTokenReqMessageContext tokReqMsgCtx) {
        return ScopesIssuer.getInstance().setScopes(tokReqMsgCtx);
    }
}

@@ -1,14 +1,13 @@
 /*%0A *
- 
  Copyrig
@@ -13,33 +13,112 @@
 ght 
-WSO2 Inc.%0A *%0A *  Licensed
+(c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.%0A *%0A * WSO2 Inc. licenses this file to you
  und
@@ -139,16 +139,19 @@
 License,
+%0A *
  Version
@@ -171,20 +171,16 @@
 cense%22);
-%0A * 
  you may
@@ -204,16 +204,19 @@
 e except
+%0A *
  in comp
@@ -242,17 +242,16 @@
 ense.%0A *
- 
  You may
@@ -292,18 +292,16 @@
 *%0A *    
- 
- 
 http://w
@@ -340,17 +340,16 @@
 .0%0A *%0A *
- 
  Unless 
@@ -399,16 +399,19 @@
 writing,
+%0A *
  softwar
@@ -411,20 +411,16 @@
 software
-%0A * 
  distrib
@@ -462,16 +462,19 @@
 ed on an
+%0A *
  %22AS IS%22
@@ -480,20 +480,16 @@
 %22 BASIS,
-%0A * 
  WITHOUT
@@ -520,16 +520,19 @@
 S OF ANY
+%0A *
  KIND, e
@@ -556,19 +556,16 @@
 implied.
-%0A *
   See th
@@ -581,16 +581,19 @@
  for the
+%0A *
  specifi
@@ -628,20 +628,16 @@
 ions and
-%0A * 
  limitat
@@ -640,16 +640,19 @@
 itations
+%0A *
  under t

format ExtendedAuthorizationCodeGrantHandler