private function getRole($identity = null)
    {
        if (is_object($identity)) {
            return $identity->getRole();
        }

        if (is_array($identity) && isset($identity['role'])) {
            return $identity['role'];
        }

        return 'guest';
    }