Skip to content

Delegated Permission Cache Key #55

@dcamargon

Description

@dcamargon

The DelegatedPermissionTrait is missing the part of setting the cacheKey when the access token is null. According to the documentation, the cache key should be {tenantId}-{clientId} but is missing that part

Possible fix: Update the setCacheKey method with the proper fallback.

public function setCacheKey(?AccessToken $accessToken = null): void
{
	if ($accessToken && $accessToken->getToken()) {
		$uniqueIdentifier = hash("sha256", $accessToken->getToken());
		$this->cacheKey = "{$this->getTenantId()}-{$this->getClientId()}-{$uniqueIdentifier}";
	} else {
		// If access is not provided fallback to default {tenantId}-{clientId}.
		$this->cacheKey = "{$this->getTenantId()}-{$this->getClientId()}";
	}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Needs Triage 🔍

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions