Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
eduGAIN Access Check - Account manager
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
edugain
eduGAIN Access Check - Account manager
Commits
a87808f1
Commit
a87808f1
authored
7 years ago
by
Guillaume ROUSSE
Browse files
Options
Downloads
Patches
Plain Diff
transfer actions and parameters definitions in WebRequest class
parent
7b2e2ec4
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
bin/account-manager-web.pl
+0
-22
0 additions, 22 deletions
bin/account-manager-web.pl
lib/IdPAccountManager/WebRequest.pm
+31
-11
31 additions, 11 deletions
lib/IdPAccountManager/WebRequest.pm
with
31 additions
and
33 deletions
bin/account-manager-web.pl
+
0
−
22
View file @
a87808f1
...
...
@@ -8,38 +8,16 @@ use lib qw(lib);
use
IdPAccountManager::
Configuration
;
use
IdPAccountManager::
WebRequest
;
## 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
$configuration
=
IdPAccountManager::
Configuration
->
new
(
file
=>
'
conf/IdPAccountManager.conf
'
);
my
%actions
=
(
'
select_sp
'
=>
{
'
title_en
'
=>
'
Select your Service Provider
'
},
'
account_wizard
'
=>
{
'
title_en
'
=>
'
Select your Service Provider
'
},
'
generate_token
'
=>
{
'
title_en
'
=>
'
Generate an authentication token
'
},
'
validate_token
'
=>
{
'
title_en
'
=>
'
Complete Email Challenge
'
},
'
home
'
=>
{
'
title_en
'
=>
$configuration
->
{
app_name
}
},
);
## Gives writes for the group
umask
0002
;
chdir
$configuration
->
{
root_manager_dir
};
my
$request
=
new
IdPAccountManager::
WebRequest
(
actions
=>
\
%actions
,
format
=>
\
%format
,
configuration
=>
$configuration
);
...
...
This diff is collapsed.
Click to expand it.
lib/IdPAccountManager/WebRequest.pm
+
31
−
11
View file @
a87808f1
...
...
@@ -13,13 +13,35 @@ use IdPAccountManager::Data::ServiceProvider;
use
IdPAccountManager::
Logger
;
use
IdPAccountManager::
SAMLMetadata
;
## 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
$configuration
=
IdPAccountManager::
Configuration
->
new
(
file
=>
'
conf/IdPAccountManager.conf
'
);
my
%actions
=
(
select_sp
=>
'
req_select_sp
',
account_wizard
=>
'
req_account_wizard
',
generate_token
=>
'
req_generate_token
',
validate_token
=>
'
req_validation_token
',
home
=>
'
req_home
',
);
## New web request
sub
new
{
my
(
$pkg
,
%args
)
=
@_
;
my
$self
=
{
format
=>
$args
{
format
},
actions
=>
$args
{
actions
},
configuration
=>
$args
{
configuration
},
};
...
...
@@ -59,7 +81,7 @@ sub execute {
$self
->
{
param_out
}
=
{
url_cgi
=>
$ENV
{
SCRIPT_NAME
},
env
=>
\
%ENV
,
actions
=>
$self
->
{
actions
}
,
actions
=>
\
%
actions
,
conf
=>
$self
->
{
configuration
},
};
...
...
@@ -74,9 +96,9 @@ sub execute {
$parameters
{
$parameter
}
=~
s/^\s+//
;
# remove leading spaces
# format check
if
(
defined
$
self
->
{
format
}
->
{
$parameter
}
&&
!
ref
(
$
self
->
{
format
}
->
{
$parameter
}))
{
if
(
$parameters
{
$parameter
}
!~
/^$
self->
format
->
{$parameter}$/
)
{
if
(
defined
$format
{
$parameter
}
&&
!
ref
(
$format
{
$parameter
}))
{
if
(
$parameters
{
$parameter
}
!~
/^$format{$parameter}$/
)
{
push
@
{
$self
->
{
param_out
}
->
{
errors
}
},
"
format_
$parameter
";
$self
->
{
logger
}
->
log
(
level
=>
LOG_ERROR
,
...
...
@@ -103,11 +125,9 @@ sub execute {
# Check the requested action
my
$action
=
$parameters
{
action
}
||
'
home
';
if
(
$self
->
{
actions
}
->
{
$action
})
{
## Execute the target subroutine named req_actionName
no
strict
'
refs
';
my
$sub
=
'
req_
'
.
$action
;
$status
=
&
{
$sub
}(
$self
);
if
(
$actions
{
$action
})
{
my
$method
=
$actions
{
$action
};
$status
=
$self
->
$method
();
}
else
{
## inknown action
push
@
{
$self
->
{
param_out
}
->
{
errors
}
},
"
unknown_action
";
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment