Skip to content
Snippets Groups Projects
Commit 06fcb0b6 authored by Guillaume ROUSSE's avatar Guillaume ROUSSE
Browse files

add explicit templates theme support

This allows to override web templates only, without forcing to
duplicated mail templates, for instance.
parent 0aca57a6
No related branches found
No related tags found
No related merge requests found
Showing
with 53 additions and 232 deletions
......@@ -2,8 +2,10 @@
support_email = support@my.fqdn
[setup]
# templates directory
# base templates directory
templates_dir = @templatesdir@
# templates theme
templates_theme = edugain
accounts_file = /var/lib/access-check/accounts.php
[logger]
......
......@@ -2,6 +2,7 @@ AC_PREREQ(2.59)
AC_INIT([Access Check Manager], 1.1.0)
AM_INIT_AUTOMAKE([foreign])
AC_REQUIRE_AUX_FILE([tap-driver.sh])
AC_PROG_LN_S
confdir=$sysconfdir/access-check
wwwdir=$datadir/access-check/www
......
......@@ -187,11 +187,23 @@ sub respond {
};
$in{data}->{lh} = $self->{lh};
## Parse template
my $theme_templates_dir = sprintf(
"%s/web/%s",
$self->{configuration}->{setup}->{templates_dir},
$self->{configuration}->{setup}->{templates_theme} || 'default'
);
my $default_templates_dir = sprintf(
"%s/web",
$self->{configuration}->{setup}->{templates_dir},
);
my $templates_dir = -d $theme_templates_dir ?
$theme_templates_dir :
$default_templates_dir;
my $tt2 = Template->new({
ENCODING => 'utf8',
PRE_CHOMP => CHOMP_ONE,
INCLUDE_PATH => $self->{configuration}->{setup}->{templates_dir} . "/web"
INCLUDE_PATH => $templates_dir
});
$self->{logger}->debug("Responding with template '$in{template}'");
......@@ -430,11 +442,24 @@ sub req_complete_challenge {
user => "internal"
) if !$token->save();
my $theme_templates_dir = sprintf(
"%s/mail/%s",
$self->{configuration}->{setup}->{templates_dir},
$self->{configuration}->{setup}->{templates_theme} || 'default'
);
my $default_templates_dir = sprintf(
"%s/mail",
$self->{configuration}->{setup}->{templates_dir},
);
my $templates_dir = -d $theme_templates_dir ?
$theme_templates_dir :
$default_templates_dir;
# build content
my $tt2 = Template->new({
ENCODING => 'utf8',
PRE_CHOMP => CHOMP_ONE,
INCLUDE_PATH => $self->{configuration}->{setup}->{templates_dir} . "/mail",
INCLUDE_PATH => $templates_dir
});
my $data = {
app => {
......
......@@ -2,24 +2,25 @@ nobase_templates_DATA = \
accounts/accounts.php.tt2 \
mail/send_authentication_token.tt2.txt \
mail/send_authentication_token.tt2.html \
web/errors.tt2.html \
web/home.tt2.html \
web/index.tt2.html \
web/select_federation.tt2.html \
web/select_sp.tt2.html \
web/select_email.tt2.html \
web/complete_challenge.tt2.html \
web/create_accounts.tt2.html \
renater/accounts/accounts.php.tt2 \
renater/mail/send_authentication_token.tt2.txt \
renater/mail/send_authentication_token.tt2.html \
renater/web/errors.tt2.html \
renater/web/home.tt2.html \
renater/web/index.tt2.html \
renater/web/select_federation.tt2.html \
renater/web/select_sp.tt2.html \
renater/web/select_email.tt2.html \
renater/web/complete_challenge.tt2.html \
renater/web/create_accounts.tt2.html
web/edugain/errors.tt2.html \
web/edugain/home.tt2.html \
web/edugain/index.tt2.html \
web/edugain/select_federation.tt2.html \
web/edugain/select_sp.tt2.html \
web/edugain/select_email.tt2.html \
web/edugain/complete_challenge.tt2.html \
web/edugain/create_accounts.tt2.html \
web/renater/errors.tt2.html \
web/renater/home.tt2.html \
web/renater/index.tt2.html \
web/renater/select_federation.tt2.html \
web/renater/select_sp.tt2.html \
web/renater/select_email.tt2.html \
web/renater/complete_challenge.tt2.html \
web/renater/create_accounts.tt2.html
EXTRA_DIST = $(nobase_templates_DATA)
install-data-hook:
cd $(DESTDIR)$(templatesdir)/web && \
$(LN_S) edugain default
<?php
// PhP configuration file loaded in simpleSamlPhp authsources.php file
$validTestAccounts = array (
'authcrypt:Hash',
[% FOREACH account IN accounts %]
'user[% account.id() %]:{SHA256}[% account.password_hash() %]=' => array(
'internal_uid' => array([% account.internal_uid().quote %]),
'associatedSP' => array([% account.associatedSP().quote %]),
[% IF account.cn() %]
'cn' => array([% account.cn().quote %]),
[% END %]
[% IF account.sn() %]
'sn' => array([% account.sn().quote %]),
[% END %]
[% IF account.displayName() %]
'displayName' => array([% account.displayName().quote %]),
[% END %]
[% IF account.givenName() %]
'givenName' => array([% account.givenName().quote %]),
[% END %]
[% IF account.mail() %]
'mail' => array([% account.mail().quote %]),
[% END %]
[% IF account.eduPersonAffiliation() %]
'eduPersonAffiliation' => array([% account.eduPersonAffiliation().quote.join(', ') %]),
[% END %]
[% IF account.eduPersonScopedAffiliation() %]
'eduPersonScopedAffiliation' => array([% account.eduPersonScopedAffiliation().quote.join(', ') %]),
[% END %]
[% IF account.eduPersonPrincipalName() %]
'eduPersonPrincipalName' => array([% account.eduPersonPrincipalName().quote %]),
[% END %]
[% IF account.schacHomeOrganization() %]
'schacHomeOrganization' => array([% account.schacHomeOrganization().quote %]),
[% END %]
[% IF account.schacHomeOrganizationType() %]
'schacHomeOrganizationType' => array([% account.schacHomeOrganizationType().quote %]),
[% END %]
),
[% END %]
);
<p>
[% lh.maketext("This is an email challenge automatically sent to you by eduGAIN Access Check.") %]
[% lh.maketext("Somebody with IP address [_1] has requested to create test accounts for eduGAIN Service Provider with entityID [_2].", sourceip, entityid) %]
[% lh.maketext("The address [_1] is mentioned in the eduGAIN metadata as a contact for this Service Provider.", to) %]
</p>
<p>[% lh.maketext("To complete the creation of test accounts, paste the following validation token in <a href=\"[_1]\">eduGAIN Access Check</a>: [_2]", challenge_url, token) %]</p>
<p>[% lh.maketext("If the creation of test accounts was not initiated by you or a fellow administrator for the above Service Provider, please forward this email and contact [_1] to inform them about a potential abuse of the eduGAIN Access Check service.", app.support_email) %]</p>
<p>[% lh.maketext("Best Regards") %]</p>
<p>eduGAIN Access Check Bot</p>
[% lh.maketext("This is an email challenge automatically sent to you by eduGAIN Access Check.") %]
[% lh.maketext("Somebody with IP address [_1] has requested to create test accounts for eduGAIN Service Provider with entityID [_2].", sourceip, entityid) %]
[% lh.maketext("The address [_1] is mentioned in the eduGAIN metadata as a contact for this Service Provider.", to) %]
[% lh.maketext("To complete the creation of test accounts, paste the following validation token in eduGAIN Access Check:") %]
- [% lh.maketext("Challenge URL: [_1]", challenge_url) %]
- [% lh.maketext("Validation token: [_1]", token) %]
[% lh.maketext("If the creation of test accounts was not initiated by you or a fellow administrator for the above Service Provider, please forward this email and contact [_1] to inform them about a potential abuse of the eduGAIN Access Check service.", app.support_email) %]
[% lh.maketext("Best Regards") %]
eduGAIN Access Check Bot
edugain
\ No newline at end of file
File moved
<div class="grid-x align-center">
<div class="cell shrink">
<div class="callout success">
<strong>Succès:</strong> votre identité comme administrateur du service <strong>[% entityid %]</strong> a été validée!
</div>
</div>
</div>
<h3>Comptes de test créés</h3>
<p>Vous pouvez maintenant utiliser ces comptes pour vous identifier sur votre
service fédéré. Pour le faire, sélectionnez <strong>[% idp_displayname
%]</strong> lors du choix du founisseur d'identité à utiliser.</p>
<p><a class="button" href="[% conf.app_url %]?action=download_accounts&entityid=[% entityid %]&token=[% token %]&key=[% key %]">Télécharger au format CSV</a></p>
<div class="accounts">
[% FOREACH account IN accounts %]
<div class="account">
<table>
<caption>Profil d'utilisateur: [% account.profile() %]</caption>
<tr>
<td><strong>nom d'utilisateur:</strong></td>
<td>user[% account.id() %]</td>
</tr>
<tr>
<td><strong>mot de passe:</strong></td>
<td>[% account.password() %]</td>
</tr>
<tr>
<td colspan="2">
<strong>commentaire:</strong>
<div class="comment">[% account.comment() %]</div>
</td>
</tr>
<tr>
<td colspan="2" class="text-center" >
<button data-open="account_details_[% account.id() %]" class="button show_account_details" id="show_account_details_[% account.id() %]">montrer les détails</button>
</td>
</tr>
</table>
</div>
<div class="reveal" data-reveal id="account_details_[% account.id() %]">
<button class="close-button" data-close aria-label="Close modal" type="button">
<span aria-hidden="true">&times;</span>
</button>
<h3>Liste des attributs utilisateur</h3>
<p>Voici la liste des attributs utilisateur associés à ce compte de
test. Ces attributs sont transmis via le protocole SAML, après une
authentification réussie, du fournisseur d'identité eduGAIN Access Check à
votre service.</p>
<div>
<table>
<caption>Liste des attributs utilisateur</caption>
[% FOREACH attribute IN [ 'cn', 'displayName', 'givenName', 'sn', 'mail', 'schacHomeOrganization', 'schacHomeOrganizationType', 'eduPersonPrincipalName' ] %]
<tr>
<th>[% attribute %]</th><td>[% account.$attribute() %]</td>
</tr>
[% END %]
[% FOREACH attribute IN [ 'eduPersonAffiliation', 'eduPersonScopedAffiliation' ] %]
<tr>
<th>[% attribute %]</th><td>[% account.$attribute().join(', ') %]</td>
</tr>
[% END %]
<tr>
<th>eduPersonTargetedID:</th><td><i>valeur générée dynamiquement par le SP</i></td>
</tr>
</table>
</div>
<div class="callout info">Si vous avez besoin d'un compte de test avec
eds attributs utilisateurs supplémentaires, vous devriez contacter
<a href="mailto:[% app.support_email %]">[% app.support_email
%]</a>.</div>
<div>(1) les attributs eduPersonAffiliation et eduPersonScoppedAffilisation sont valorisés différement d'une fédération à une autre. <a href="http://tnc2010.terena.org/files/ePSA%20comparison%20v0%2006.ppt">Cette comparaison des usages de l'attribut eduPersonAffiliation dans plusieurs pays</a> discute de ces différences. C'est pourquoi ces valeurs doivent être traitées avec prudence.</div>
</div>
[% END %]
</div>
<div class="grid-x align-center">
<div class="cell shrink">
<div class="callout warning">
<p>Veuillez noter que ces comptes de test expirent automatiquement dans [% accounts_validity_period %] jours, et qu'ils ne peuvent être utilisés que pour tester l'authentification fédérée sur le service <strong>[% entityid %]</strong>.</p>
</div>
</div>
</div>
<div class="grid-x align-center">
<div class="cell shrink">
<strong>Merci d'avoir utilisé eduGain Access Check</strong>
</div>
</div>
<DOCTYPE! html>
[% INCLUDE $content %]
<DOCTYPE! html>
<html lang="fr">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<meta charset="utf-8">
<link rel="icon" type="image/png" href="images/favicon.png" />
<link rel="stylesheet" type="text/css" href="foundation/css/foundation.min.css">
<link rel="stylesheet" type="text/css" href="jquery-ui-1.12.1/jquery-ui.min.css" />
<link rel="stylesheet" type="text/css" href="css/style.css" />
<script type="text/javascript" src="jquery-3.3.1.min.js"></script>
<script type="text/javascript" src="jquery-steps-1.1.0.min.js"></script>
<script type="text/javascript" src="jquery-ui-1.12.1/jquery-ui.min.js"></script>
<script type="text/javascript" src="jquery-validation-1.17.0.min.js"></script>
<script type="text/javascript" src="account-manager.js"></script>
<title>eduGAIN Access Check</title>
</head>
<body>
<header>
<div class="clearfix">
<a href="http://www.edugain.org" title="eduGAIN home page" target="_blank" class="float-left"><img alt="eduGAIN logo" width="200" src="images/edugain_logo.png"/></a>
<a href="http://www.geant.net" title="Geant home page" target="_blank" class="float-right"><img alt="GEANT logo" width="100" src="images/geant_logo_rgb_300dpi.jpg"/></a>
</div>
<h1><a href="[% app.url %]">eduGAIN Access Check</a></h1>
</header>
<main>
[% INCLUDE $content %]
</main>
<footer>
<p class="text-center">eduGAIN Access Check [% app.version %] - <a href="mailto:[% app.support_email %]">contactez nous</a></p>
</footer>
<script src="foundation/js/vendor/what-input.js"></script>
<script src="foundation/js/vendor/foundation.min.js"></script>
<script>
$(document).foundation();
</script>
</body>
</html>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment