-
renater.salaun authored
First working version of the code git-svn-id: https://svn.geant.net/GEANT/edugain_testidp_account_manager/trunk@20 047e039d-479c-447e-8a29-aa6bf4a09bab
renater.salaun authoredFirst working version of the code git-svn-id: https://svn.geant.net/GEANT/edugain_testidp_account_manager/trunk@20 047e039d-479c-447e-8a29-aa6bf4a09bab
account-manager-web.pl 14.25 KiB
#!/usr/bin/perl
## 15/09/2014, Olivier Salaün
## Web interface for the eduGAIN Test IdP Account Manager
use strict vars;
use utf8;
use lib "/opt/testidp/IdPAccountManager/lib";
use lib "/opt/testidp/IdPAccountManager/conf";
use CGI;
use CGI::Cookie;
use CGI::Util;
use Template;
use Template::Constants qw( :debug );
use POSIX;
use IdPAccountManager::TestAccount;
use IdPAccountManager::SAMLMetadata;
use IdPAccountManager::ServiceProvider;
use IdPAccountManager::AuthenticationToken;
## Defining parameters format
my $urn_or_url_regex = '(http(s?):\/\/|urn:)[^\\\$\*\"\'\`\^\|\<\>\n\s]+'; ## Format de type URL HTTP ou URN
my $url_regex = 'http(s?):\/\/[^\\\$\*\"\'\`\^\|\<\>\n\s]+';
my $email_regex = '([\w\-\_\.\/\+\=\'\&]+|\".*\")\@[\w\-]+(\.[\w\-]+)+';
my $domains_regex = '[\w\.\-]+(,[\w\.\-]+)*';
my %format = (
## URL
#'attributeauthority' => $url_regex,
'sp_entityid' => $urn_or_url_regex,
);
my %actions = ('select_sp' => {'title_en' => 'Select your Service Provider' },
'get_sp_list' => {'title_en' => 'Select your Service Provider' },
'generate_token' => {'title_en' => 'Generate an authentication token'},
'validate_token' => {'title_en' => 'Validate an authentication token'},
);
## Gives writes for the group
umask 0002;
chdir $Conf::global{'root_manager_dir'};
my $request = new WebRequest;
if (defined $request) {
$request->execute();
}
$request->respond();
package WebRequest;
## New web request
sub new {
my $pkg = shift;
my $request = {};
&IdPAccountManager::Tools::do_log('info', "");
my $http_query = new CGI;
## Input parameters
my %in_vars = $http_query->Vars;
$request->{'param_in'} = \%in_vars;
## Check if admin acts as another user
$request->{'cookies'} = CGI::Cookie->fetch;