fkooman\RemoteStorage\ApiTestTokenValidator::validate PHP Method

validate() public method

public validate ( $bearerToken ) : fkooman\Rest\Plugin\Authentication\Bearer\TokenInfo
return fkooman\Rest\Plugin\Authentication\Bearer\TokenInfo
    public function validate($bearerToken)
    {
        switch ($bearerToken) {
            case 'token':
                return new TokenInfo(array('active' => true, 'username' => 'demo', 'scope' => 'api-test:rw'));
            case 'root_token':
                return new TokenInfo(array('active' => true, 'username' => 'demo', 'scope' => '*:rw'));
            case 'read_only_token':
                return new TokenInfo(array('active' => true, 'username' => 'demo', 'scope' => 'api-test:r'));
            case '12345':
                return new TokenInfo(array('active' => true, 'username' => 'foo', 'scope' => 'foo:rw bar:r'));
            default:
                return new TokenInfo(array('active' => false));
        }
    }
ApiTestTokenValidator