Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UPS-5145 Keycloak fix UiTiDv1 fallback #197

Merged
merged 4 commits into from
Jul 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# CODEOWNERS are automatically assigned as possible reviewers to new PRs.

# Global owners (also need to be duplicated in later rules)
* @LucWollants @JonasVHG @simon-debruijn @grubolsch

# Jenkins / deployment owners
Gemfile* @willaerk @paulherbosch
Jenkinsfile @willaerk @paulherbosch
Rakefile @willaerk @paulherbosch
lib/ @willaerk @paulherbosch
8 changes: 2 additions & 6 deletions bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,8 @@ function () use ($app, $options) {
/**
* Authentication services
*/
$app['auth0_enabled'] = isset($app['config']['auth0']['enable']) && $app['config']['auth0']['enable'] === true;
if ($app['auth0_enabled']) {
$app->register(new AuthServiceProvider());
} else {
$app->register(new CultuurNet\UiTIDProvider\Auth\AuthServiceProvider());
}

$app->register(new AuthServiceProvider());

/**
* UiTID User services.
Expand Down
31 changes: 5 additions & 26 deletions bootstrap/logging.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

const MESSAGE_FORMAT = ">>>>>>>>\n{request}\n<<<<<<<<\n{response}\nTime: {total_time}s\n--------\n{curl_stderr}";

$app['third_party_api_log'] = $app->share(
$app['third_party_api_log'] = $app::share(
function () {
$handler = new \Monolog\Handler\StreamHandler(
__DIR__ . '/../log/third_party_api.log'
Expand All @@ -19,7 +19,7 @@ function () {
}
);

$app['third_party_api_logger_factory'] = $app->protect(
$app['third_party_api_logger_factory'] = $app::protect(
function ($name) use ($app) {
$logger = new Monolog\Logger($name);
$logger->pushHandler(
Expand All @@ -30,31 +30,10 @@ function ($name) use ($app) {
}
);

if (!$app['auth0_enabled']) {
$app['uitid_auth_service'] = $app->share(
$app->extend(
'uitid_auth_service',
function (\CultuurNet\Auth\Guzzle\Service $service, \Silex\Application $app) {
/** @var \Psr\Log\LoggerInterface $logger */
$logger = $app['third_party_api_logger_factory']('cultuurnet_auth');

$logPlugin = new \Guzzle\Plugin\Log\LogPlugin(
new \Guzzle\Log\PsrLogAdapter($logger),
MESSAGE_FORMAT
);

$service->addSubscriber($logPlugin);

return $service;
}
)
);
}

/**
* Enable logging on the guzzle client of Culturefeed.
*/
$app['culturefeed_http_client_guzzle'] = $app->share(
$app['culturefeed_http_client_guzzle'] = $app::share(
$app->extend(
'culturefeed_http_client_guzzle',
function (\Guzzle\Http\Client $service, \Silex\Application $app) {
Expand All @@ -73,7 +52,7 @@ function (\Guzzle\Http\Client $service, \Silex\Application $app) {
)
);

$app['expense_report_api'] = $app->share(
$app['expense_report_api'] = $app::share(
$app->extend(
'expense_report_api',
function (\CultuurNet\UiTPASBeheer\ExpenseReport\ExpenseReportApiService $service, \Silex\Application $app) {
Expand All @@ -92,7 +71,7 @@ function (\CultuurNet\UiTPASBeheer\ExpenseReport\ExpenseReportApiService $servic
)
);

$app['datavalidation_guzzle_client'] = $app->share(
$app['datavalidation_guzzle_client'] = $app::share(
$app->extend(
'datavalidation_guzzle_client',
function (\Guzzle\Http\Client $service, \Silex\Application $app) {
Expand Down
3 changes: 2 additions & 1 deletion docker/php/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM php:7.1-apache
FROM php:7.4-apache

RUN apt-get update && apt-get install -y --no-install-recommends git zip unzip libicu-dev libtidy-dev zlib1g-dev libpng-dev libzip-dev

Expand Down Expand Up @@ -37,6 +37,7 @@ RUN npm run bower -- install &
ENV APACHE_DOCUMENT_ROOT=/var/www/html/web
RUN sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf
RUN sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf
RUN echo "LimitRequestFieldSize 32766" >> /etc/apache2/conf-available/security.conf

RUN pecl install xdebug-2.9.8 && docker-php-ext-enable xdebug
COPY xdebug.ini $PHP_INI_DIR/conf.d/docker-php-ext-xdebug.ini
6 changes: 1 addition & 5 deletions web/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,7 @@
/**
* API callbacks for authentication.
*/
if ($app['auth0_enabled']) {
$app->mount('culturefeed/oauth', new AuthControllerProvider());
} else {
$app->mount('culturefeed/oauth', new \CultuurNet\UiTIDProvider\Auth\AuthControllerProvider());
}
$app->mount('culturefeed/oauth', new AuthControllerProvider());

/**
* API callbacks for UiTID user data and methods.
Expand Down
Loading