protected function segments(string $token): array
    {
        $segments = explode('.', $token);

        if (3 !== count($segments)) {
            throw new Exception("Malformed jwt received.");
        }

        return $segments;
    }