contract Authorization is Ownable{
    
    address[] private contracts;
    
    /**
    * @dev Throws if _addr address was not contract address.
    */
    modifier withContract(address _addr){
        uint length;
        assembly { length := extcodesize(_addr) }
        require(length > 0);
        _;
    }
    
    /**
    * @dev constructor for deploy Authenticity contract with _contractAddress.
    * @param _contractAddress address of ERC223 contract that need to authenticate.
    */
    constructor(address _contractAddress) public {
        contracts.push(_contractAddress);
    }

    /**
    * @dev isAuthorizedAddress for check checkAddress was authenticate or not.
    * @param checkAddress address of ERC223 contract that check for authenticate.
    * @return true if isAuthorizedAddress execute successfully.
    */
    function isAuthorizedAddress(address checkAddress) public view withContract(checkAddress) returns (bool success) {
        for(uint i = 0; i<contracts.length;i++ )
        if(checkAddress==contracts[i]) success=true;
    }
    
    /**
    * @dev AuthorizeContract for add _contractAddress into authenticate contract.
    * @param _contractAddress address of ERC223 contract that need to authenticate.
    * @return true if AuthorizeContract execute successfully.
    */
    function AuthorizeContract(address _contractAddress) onlyOwner withContract(_contractAddress) public returns (bool success){
        if(!isAuthorizedAddress(_contractAddress)) contracts.push(_contractAddress);
        return true;
    }
    
    /**
    * @dev that return total number of authenticated contracts.
    * @return total authenticated addresses.
    */
    function getAuthorizeContracts() public view returns (uint){
        return contracts.length;
    }
}
/**
 * @title Authorization
 * @dev Authorization contract for authenticate ERC223 contracts.
 */
function AuthorizeContract(address _contractAddress) onlyOwner withContract(_contractAddress) public returns (bool success){
    if(!isAuthorizedAddress(_contractAddress)) contracts.push(_contractAddress);
    return true;
}

/**
 * @dev AuthorizeContract for add _contractAddress into authenticate contract.
 * @param _contractAddress address of ERC223 contract that need to authenticate.
 * @return true if AuthorizeContract execute successfully.
 */