true, supported authentication schemes */ private $authSchemes = []; /** @var AuthMechanism|callable authentication mechanism fallback */ private $legacyAuthMechanism; /** * @return class-string */ public function getStorageClass() { return $this->storageClass; } /** * @param string $class * @return $this */ public function setStorageClass($class) { $this->storageClass = $class; return $this; } /** * @return array */ public function getAuthSchemes() { if (empty($this->authSchemes)) { return [AuthMechanism::SCHEME_NULL => true]; } return $this->authSchemes; } /** * @param string $scheme * @return self */ public function addAuthScheme($scheme) { $this->authSchemes[$scheme] = true; return $this; } /** * @param array $parameters storage parameters, for dynamic mechanism selection * @return AuthMechanism */ public function getLegacyAuthMechanism(array $parameters = []) { if (is_callable($this->legacyAuthMechanism)) { return call_user_func($this->legacyAuthMechanism, $parameters); } return $this->legacyAuthMechanism; } public function setLegacyAuthMechanism(AuthMechanism $authMechanism): self { $this->legacyAuthMechanism = $authMechanism; return $this; } /** * @param callable $callback dynamic auth mechanism selection */ public function setLegacyAuthMechanismCallback(callable $callback): self { $this->legacyAuthMechanism = $callback; return $this; } /** * Serialize into JSON for client-side JS */ public function jsonSerialize(): array { $data = $this->jsonSerializeDefinition(); $data += $this->jsonSerializeIdentifier(); $data['backend'] = $data['name']; // legacy compat $data['priority'] = $this->getPriority(); $data['authSchemes'] = $this->getAuthSchemes(); return $data; } /** * Check if parameters are satisfied in a StorageConfig * * @param StorageConfig $storage * @return bool */ public function validateStorage(StorageConfig $storage) { return $this->validateStorageDefinition($storage); } }