apiVersion: v1
kind: ConfigMap
metadata:
  name: keycloak-proxy-config
data:
  httpd.conf: |
    <VirtualHost *:80>

        ServerName ingress.streaming-platform.com

        OIDCCryptoPassphrase a-random-secret-used-by-apache-oidc-and-balancer
        OIDCProviderMetadataURL https://keycloak.streaming-platform.com/auth/realms/master/.well-known/openid-configuration
        
        OIDCRedirectURI https://ingress.streaming-platform.com/redirect_uri
        OIDCClientID openid-connect
        OIDCClientSecret b7271660-5b45-4a42-a30c-6c5243c610b1
        OIDCRemoteUserClaim preferred_username

        <Location />
            AuthType openid-connect
            Require valid-user
        </Location>

        ProxyPassMatch  ^/camera/stream/(.*)$ http://motion-$1:8081

      
        ProxyPass "/"  "http://jenkins-ui:8080/" nocanon
        ProxyPassReverse "/"  "http://jenkins-ui:8080/" nocanon


    </VirtualHost>
    <VirtualHost *:80>

        ServerName kibana.streaming-platform.com

        OIDCCryptoPassphrase a-random-secret-used-by-apache-oidc-and-balancer
        OIDCProviderMetadataURL https://keycloak.streaming-platform.com/auth/realms/master/.well-known/openid-configuration
        
        OIDCRedirectURI https://ingress.streaming-platform.com/redirect_uri
        OIDCClientID openid-connect
        OIDCClientSecret b7271660-5b45-4a42-a30c-6c5243c610b1
        OIDCRemoteUserClaim preferred_username

        <Location />
            AuthType openid-connect
            Require valid-user
        </Location>

        ProxyPass "/"  "http://kibana/" nocanon
        ProxyPassReverse "/"  "http://kibana/" nocanon

    </VirtualHost>