/** * Sets the internal filters based on the given configuration. * * @param array $filterSettings The filter settings * @return void */ protected function buildFiltersFromSettings(array $filterSettings) { foreach ($filterSettings as $singleFilterSettings) { $requestPattern = $this->objectManager->get($this->requestPatternResolver->resolveRequestPatternClass($singleFilterSettings['patternType'])); $requestPattern->setPattern($singleFilterSettings['patternValue']); $interceptor = $this->objectManager->get($this->interceptorResolver->resolveInterceptorClass($singleFilterSettings['interceptor'])); $this->filters[] = $this->objectManager->get('TYPO3\\FLOW3\\Security\\Authorization\\RequestFilter', $requestPattern, $interceptor); } }
/** * Builds the provider and token objects based on the given configuration * * @param array $providerConfigurations The configured provider settings * @return void * @throws \TYPO3\FLOW3\Security\Exception\InvalidAuthenticationProviderException * @throws \TYPO3\FLOW3\Security\Exception\NoEntryPointFoundException */ protected function buildProvidersAndTokensFromConfiguration(array $providerConfigurations) { foreach ($providerConfigurations as $providerName => $providerConfiguration) { if (isset($providerConfiguration['providerClass'])) { throw new \TYPO3\FLOW3\Security\Exception\InvalidAuthenticationProviderException('The configured authentication provider "' . $providerName . '" uses the deprecated option "providerClass". Check your settings and use the new option "provider" instead.', 1327672030); } if (isset($providerConfiguration['options'])) { throw new \TYPO3\FLOW3\Security\Exception\InvalidAuthenticationProviderException('The configured authentication provider "' . $providerName . '" uses the deprecated option "options". Check your settings and use the new option "providerOptions" instead.', 1327672031); } if (!is_array($providerConfiguration) || !isset($providerConfiguration['provider'])) { throw new \TYPO3\FLOW3\Security\Exception\InvalidAuthenticationProviderException('The configured authentication provider "' . $providerName . '" needs a "provider" option!', 1248209521); } $providerObjectName = $this->providerResolver->resolveProviderClass((string) $providerConfiguration['provider']); if ($providerObjectName === NULL) { throw new \TYPO3\FLOW3\Security\Exception\InvalidAuthenticationProviderException('The configured authentication provider "' . $providerConfiguration['provider'] . '" could not be found!', 1237330453); } $providerOptions = array(); if (isset($providerConfiguration['providerOptions']) && is_array($providerConfiguration['providerOptions'])) { $providerOptions = $providerConfiguration['providerOptions']; } $providerInstance = new $providerObjectName($providerName, $providerOptions); $this->providers[] = $providerInstance; foreach ($providerInstance->getTokenClassNames() as $tokenClassName) { if (isset($providerConfiguration['token']) && $providerConfiguration['token'] !== $tokenClassName) { continue; } $tokenInstance = new $tokenClassName(); $tokenInstance->setAuthenticationProviderName($providerName); $this->tokens[] = $tokenInstance; break; } if (isset($providerConfiguration['requestPatterns']) && is_array($providerConfiguration['requestPatterns'])) { $requestPatterns = array(); foreach ($providerConfiguration['requestPatterns'] as $patternType => $patternConfiguration) { $patternClassName = $this->requestPatternResolver->resolveRequestPatternClass($patternType); $requestPattern = new $patternClassName(); $requestPattern->setPattern($patternConfiguration); $requestPatterns[] = $requestPattern; } $tokenInstance->setRequestPatterns($requestPatterns); } if (isset($providerConfiguration['entryPoint'])) { if (is_array($providerConfiguration['entryPoint'])) { $message = 'Invalid entry point configuration in setting "TYPO3:FLOW3:security:authentication:providers:' . $providerName . '. Check your settings and make sure to specify only one entry point for each provider.'; throw new \TYPO3\FLOW3\Security\Exception\InvalidAuthenticationProviderException($message, 1327671458); } $entryPointName = $providerConfiguration['entryPoint']; $entryPointClassName = $entryPointName; if (!class_exists($entryPointClassName)) { $entryPointClassName = 'TYPO3\\FLOW3\\Security\\Authentication\\EntryPoint\\' . $entryPointClassName; } if (!class_exists($entryPointClassName)) { throw new \TYPO3\FLOW3\Security\Exception\NoEntryPointFoundException('An entry point with the name: "' . $entryPointName . '" could not be resolved. Make sure it is a valid class name, either fully qualified or relative to TYPO3\\FLOW3\\Security\\Authentication\\EntryPoint!', 1236767282); } $entryPoint = new $entryPointClassName(); if (isset($providerConfiguration['entryPointOptions'])) { $entryPoint->setOptions($providerConfiguration['entryPointOptions']); } $tokenInstance->setAuthenticationEntryPoint($entryPoint); } } }