public function fromAbstract($tokenAbstract)
    {
        // Detect type of token
        $re = "/(~" . self::PREFIX_APP . "|~" . self::PREFIX_NONCE . "|~" . self::PREFIX_TOKEN . "|~" . self::PREFIX_REALM . ")/m";

        if (preg_match_all($re, $tokenAbstract, $matches) == 4) {
            $token = $this->fromParameter($tokenAbstract);
        } else {
            $token = $this->fromHeader($tokenAbstract);
        }

        return $token;
    }