Commit 26b55200 authored by Remi Cresson's avatar Remi Cresson
Browse files

1st commit

parent 7b04c964
No related merge requests found
Pipeline #42756 passed with stage
in 1 minute and 22 seconds
Showing with 14 additions and 2 deletions
+14 -2
FROM ubuntu/apache2
RUN sed -i 's#<Directory /var/www/>#<Directory /var/www/>\n Header set Access-Control-Allow-Origin "*"#g' /etc/apache2/apache2.conf
RUN apt update && apt install --no-install-recommends -y libapache2-mod-oauth2 && apt-get clean && rm -rf /var/lib/apt/lists/*
RUN a2enmod headers
RUN a2enmod oauth2
RUN sed -i 's#Require all granted#Require valid-user#g' /etc/apache2/apache2.conf
RUN sed -i 's#<Directory /var/www/>#<Directory /var/www/>\n OAuth2TokenVerify introspect \${TOKEN_ENDPOINT} introspect.ssl_verify=false\&introspect.auth=client_secret_basic\&client_id=\${CLIENT_ID}\&client_secret=\${CLIENT_SECRET}#g' /etc/apache2/apache2.conf
RUN sed -i 's#<Directory /var/www/>#<Directory /var/www/>\n AuthType oauth2#g' /etc/apache2/apache2.conf
RUN sed -i 's#<Directory /var/www/>#<Directory /var/www/>\n Header set Access-Control-Allow-Origin "*"#g' /etc/apache2/apache2.conf
RUN sed -i 's#<Directory /var/www/>#<Directory /var/www/>\n SetEnv TOKEN_ENDPOINT ${TOKEN_ENDPOINT}#g' /etc/apache2/apache2.conf
RUN sed -i 's#<Directory /var/www/>#<Directory /var/www/>\n SetEnv CLIENT_ID ${CLIENT_ID}#g' /etc/apache2/apache2.conf
RUN sed -i 's#<Directory /var/www/>#<Directory /var/www/>\n SetEnv CLIENT_SECRET ${CLIENT_SECRET}#g' /etc/apache2/apache2.conf
RUN echo 'export TOKEN_ENDPOINT=${TOKEN_ENDPOINT}' >> /etc/environment && \
echo 'export CLIENT_ID=${CLIENT_ID}' >> /etc/environment && \
echo 'export CLIENT_SECRET=${CLIENT_SECRET}' >> /etc/environment
RUN echo ". /etc/environment" >> /etc/apache2/envvars
# Apache2 CORS
# Apache2 CORS + OAuth2
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment