public function setAllowedGrantTypes($allowedGrantTypes)
    {
        foreach ($allowedGrantTypes as $allowedGrantType) {
            if (!in_array($allowedGrantType, $this->availableGrantTypes)) {
                throw new \Exception('Unknown grant type ' . $allowedGrantType);
            }
        }
        $this->allowedGrantTypes = $allowedGrantTypes;
    }