avarteniuc
avarteniuc

Reputation: 1

Apache Mellon Configuration

I'm trying to configure an apache server for an saml authentication and I'm using apache mellon for this.

I configured the apache and in /var/www/html I wrote an simple php server with 2 routes: / and /spa/callback/postResponse.

The problem is that after the login into the identity provider the redirect won't stop (it looks like it is keep posting to my /spa/callback/postResponse route).

I guess that the problem is the mellon config, but I don't know how to configure it.

My 000-default.conf looks like this:

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html

    <Directory "/var/www/html">
         AllowOverride All
    </Directory>

    <Location />
    # Add information from the mod_auth_mellon session to the request.
    MellonEnable "info"

    # Configure the SP metadata
    # This should be the files which were created when creating SP metadata.
    MellonSPPrivateKeyFile /var/www/saml_sp.key

    MellonSPCertFile /var/www/saml_sp.cert
    MellonSPMetadataFile /var/www/saml_sp.xml

    # IdP metadata. This should be the metadata file you got from the IdP.
    MellonIdPMetadataFile /var/www/metadata.xml

        MellonSamlResponseDump On
    MellonIDP "IDP"
        MellonSetEnv "username" "username"

    # The location all endpoints should be located under.
    # It is the URL to this location that is used as the second parameter to the metadata generation script.
    # This path is relative to the root of the web server.
    MellonEndpointPath /mellon
</Location>

# This is a location that will trigger authentication when requested.
<Location /auth_mellon.php>
    # This location will trigger an authentication request to the IdP.
    MellonEnable "auth"
</Location>

        <Location />
    #This location will trigger an authentication request to the IdP.
    MellonEnable "auth"
    </Location>


    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

In the /var/www/html I have some php files, and the index.php looks like this:

<?php

include_once 'Request.php';
include_once 'Router.php';
$router = new Router(new Request);

$router->get('/', function() {
  return <<<HTML
  <h1>Hello world</h1>
HTML;
});

$router->post('/spa/callback/postResponse', function() {
    exit();
    return;
});


$router->get('/profile', function($request) {
  return <<<HTML
  <h1>Profile</h1>
HTML;
});

$router->post('/data', function($request) {

  return json_encode($request->getBody());
});

Upvotes: 0

Views: 3618

Answers (0)

Related Questions