Get an array of static tokens from the configuration file.

@return array
Each tokens entry is keyed with its token value. Each token array contains:
- token
- user
- roles
164586
public function getStaticTokens()
    {
        $tokens = [];
        $sites = [];
        if (!$this->getValid()) {
            return $sites;
        }
        foreach ($this->xml->children() as $child) {
            if ($child->getName() == "token") {
                $token = $this->parseToken($child);
                if ($token !== false) {
                    $tokens[$token['token']] = $token;
                }
            }
        }
        return $tokens;
    }
612030
public function getRolesForUserCreation()
    {
        $rolesList = [];

        // logged user
        $user = auth()->user();

        if( auth()->check() ) {
            if( $user->isSuperAdmin() ) {
                $rolesList = Roles::select('id', 'name as label')->orderBy('name')->get();
            } else {
                foreach ( $user->roles as $role ) {
                    $rolesList[] = [
                        'id'    => $role->id,
                        'label' => $role->name,
                    ];
                }
            }
        }

        return $rolesList;
    }
255052
public function getAccessToken()
    {
        // get token from cache file
        $result = $this->readAccessToken();
        if ('' != $result) {
            return $result;
        }

        // get token from we chat api
        $data   = $this->getAccessTokenFromWeChat();
        // save token to cache data
        $this->saveAccessToken($data['token'], $data['expire']);

        return $data['token'];
    }
818684
private function getSearchSuggestions()
    {
        $tokens = $this->getTokens();
        $allResults = array();
        foreach ($tokens as $token) {
            $allResults = $this->getSearchSuggestion($token, $allResults);
        }
        return $allResults;
    }
1347969
public function getRoles()
    {
        $data  = $this->getData();
        $roles = KObjectConfig::unbox($data->roles);

        if(empty($roles)) {
            $this->getSession()->set('user.roles', JAccess::getAuthorisedViewLevels($this->getId()));
        }

        return parent::getRoles();
    }
793251
public function tokens()
    {
        return $this->hasMany(Token::class, 'user_id')
            ->join('oauth_access_token_providers', function ($join) {
                $join->on(
                    'oauth_access_tokens.id', '=', 'oauth_access_token_id'
                )->where('oauth_access_token_providers.provider', '=', AuthConfigHelper::getUserProvider($this));
            })->orderBy('created_at', 'desc')
            ->select('oauth_access_tokens.*')
            ->get();
    }
133468
private function get_defaults() {
    $defaults = array(
      'oauth_version'          => $this->config['oauth_version'],
      'oauth_nonce'            => $this->config['nonce'],
      'oauth_timestamp'        => $this->config['timestamp'],
      'oauth_consumer_key'     => $this->config['consumer_key'],
      'oauth_signature_method' => $this->config['oauth_signature_method'],
    );

    // include the user token if it exists
    if ( $this->config['user_token'] )
      $defaults['oauth_token'] = $this->config['user_token'];

    // safely encode
    foreach ($defaults as $k => $v) {
      $_defaults[$this->safe_encode($k)] = $this->safe_encode($v);
    }

    return $_defaults;
  }
1194145
public function getDefaultUploadDestinations()
    {
        $user = $this->container->get('security.token_storage')->getToken()->getUser();
        if ($user == 'anon.') return array();

        $pws = $user->getPersonalWorkspace();
        $defaults = [];

        if ($pws) {
            $defaults = array_merge(
                $defaults,
                $this->directoryRepo->findDefaultUploadDirectories($pws)
            );
        }

        $node = $this->container->get('request')->getSession()->get('current_resource_node');

        if ($node && $node->getWorkspace()) {
            $root = $this->directoryRepo->findDefaultUploadDirectories($node->getWorkspace());
            
            if ($this->container->get('security.authorization_checker')->isGranted('CREATE', $root)) {
                $defaults = array_merge($defaults, $root);
            }
        }

        return $defaults;
    }
469879
protected function getRepositoryCredentials()
    {
        $config = (array) $this->config->getContextually('vcs');
        $credentials = (array) $this->localStorage->get('credentials');

        return array_merge($config, $credentials);
    }
662456
private function queryTokens()
    {
        $tokens = $this->getTokens();

        $queryNorm = $this->getQueryNorm($tokens);
        $results = array();
        foreach ($tokens as $token) {
            $results[$token] = $this->getResultsForToken($token, $queryNorm);
        }
        return $results;
    }
712996
public function getAuthorization()
    {
        if (!$this->hasHeader('Authorization')) {
            return null;
        }
        $temp = explode(' ', trim($this->getHeaderLine('Authorization')), 2);
        switch (strtolower($temp[0])) {
            case 'basic':
                $temp[1] = base64_decode($temp[1]);
                $temp[1] = explode(':', $temp[1], 2);
                return ['username' => $temp[1][0], 'password' => $temp[1][1] ?? null];
            case 'token':
            case 'oauth':
            case 'bearer':
                return ['token' => $temp[1] ?? null];
            default:
                return null;
        }
    }
48419
public function toArray(): array
    {
        return [
            'uuid' => $this->tokenUUID->toArray(),
            'app_uuid' => $this->appUUID->toArray(),
            'created_at' => $this->createdAt,
            'updated_at' => $this->updatedAt,
            'indices' => array_map(function (IndexUUID $indexUUID) {
                return $indexUUID->toArray();
            }, $this->indices),
            'endpoints' => $this->endpoints,
            'plugins' => $this->plugins,
            'ttl' => $this->ttl,
            'metadata' => $this->metadata,
        ];
    }
1025970
public function getCredentials()
    {
        if ($this->login) return array( $this->login, $this->password);

        //Try to find the password inside symfony configuration
        if ($this->isSymfony() && $this->symfonyContainer->hasParameter('pb_private_key')) {
            return array('api', $this->symfonyContainer->getParameter('pb_private_key'));
        }

        //Using static PureBilling as fallback
        if (class_exists('\PureBilling') && \PureBilling::getPrivateKey()) {
            return array('api', \PureBilling::getPrivateKey());
        }
    }
1090353
public function getTagTokens(): array
    {
        $iteratedPos = 0;
        $tagPositions = $this->getCommentStartToken()['comment_tags'];
        $tagTokens = [];

        /** @var int $tagPos */
        foreach ($tagPositions as $tagPos) {
            if ($tagPos >= $iteratedPos) {
                $tagTokens[$tagPos] = $this->tokens[$tagPos] + [
                    'contents' => $this->loadTagContentTokens($tagPos, $iteratedPos)
                ];
            }
        }

        return $tagTokens;
    }
671747
public function getConfig(): array
    {
        if (empty($this->config)) {
            $yamlParser = new Parser();
            $files = $this->getFileNames();
            $config = [];
            foreach ($files as $file) {
                $fileConfig = $yamlParser->parseFile($file);
                $config = \array_merge($config, $fileConfig);
            }
            $this->config = $config;
        }
        return $this->config;
    }
118853
protected function getTokenByClientCredentialsGrant()
    {
        $token = $this->getAuthorizationServer()->getAccessToken('client_credentials', [
            'scope' => $this->config['client_credentials']['scope'],
        ]);

        $this->getFrameworkBridge()->persistClientToken(
            $this->config['client_credentials']['client_id'],
            $token->getToken(),
            $token->getExpires(),
            $token->getValues()['role']
        );

        return $token;
    }
63436
public function getAuthenticationsAsArray()
    {

        // initialize the array for the authentications
        $authentications = array();

        // iterate over the authentication nodes and sort them into an array
        /** @var \AppserverIo\Appserver\Core\Api\Node\AuthenticationNode $authenticationNode */
        foreach ($this->getAuthentications() as $authenticationNode) {
            $authentications[$authenticationNode->getUri()] = $authenticationNode->getParamsAsArray();
        }

        // return the array
        return $authentications;
    }