line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Lemonldap::Federation::ShibbolethRequestMap; |
2
|
1
|
|
|
1
|
|
26184
|
use Lemonldap::Federation::SplitURI ; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
36
|
|
3
|
1
|
|
|
1
|
|
38
|
use URI::Escape ; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
1009
|
|
4
|
|
|
|
|
|
|
our $VERSION= '1.0.0'; |
5
|
|
|
|
|
|
|
sub new { |
6
|
0
|
|
|
0
|
0
|
|
my $class =shift; |
7
|
0
|
|
|
|
|
|
my %args = @_; |
8
|
0
|
|
|
|
|
|
my $self; |
9
|
0
|
|
|
|
|
|
$self=\%args; |
10
|
0
|
|
|
|
|
|
my $uri = $self->{uri}; |
11
|
0
|
|
|
|
|
|
my $obj= Lemonldap::Federation::SplitURI->new (uri=> $uri ); |
12
|
0
|
|
|
|
|
|
$self->{host}=$obj->get_host; |
13
|
0
|
|
|
|
|
|
$self->{scheme} = $obj->get_scheme; |
14
|
0
|
|
|
|
|
|
$self->{port} = $obj->get_port; |
15
|
0
|
|
|
|
|
|
$self->{ref_of_array_of_path} = $obj->get_ref_array_of_path; |
16
|
0
|
|
|
|
|
|
bless $self,$class; |
17
|
0
|
|
|
|
|
|
return $self; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
sub application_id { |
20
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
21
|
0
|
|
|
|
|
|
my $h_host = $self->{xml_host}->{Host} ; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
### id par defaut = default |
24
|
0
|
|
|
|
|
|
$self->{application_id} = 'default' ; |
25
|
0
|
|
|
|
|
|
my$authtype ; |
26
|
|
|
|
|
|
|
my $require ; |
27
|
0
|
|
|
|
|
|
my $export ; |
28
|
0
|
|
|
|
|
|
my $tmp_id ; |
29
|
0
|
|
|
|
|
|
my $f_match; |
30
|
0
|
|
|
|
|
|
my $host = $self->{host}; |
31
|
0
|
|
|
|
|
|
my $scheme = $self->{scheme}; |
32
|
0
|
|
|
|
|
|
my $port = $self->{port}; |
33
|
0
|
|
|
|
|
|
my $ref_of_array_of_path= $self->{ref_of_array_of_path}; |
34
|
0
|
0
|
|
|
|
|
if (exists $h_host->{$host} ) { |
35
|
|
|
|
|
|
|
# il faut veriffier le schemas et port |
36
|
0
|
|
|
|
|
|
my %_host =%{$h_host->{$host}}; |
|
0
|
|
|
|
|
|
|
37
|
0
|
|
|
|
|
|
$f_match = 1; |
38
|
0
|
0
|
0
|
|
|
|
$f_match =0 if ((exists $_host{scheme}) && ($_host{scheme} ne $scheme)); |
39
|
0
|
0
|
0
|
|
|
|
$f_match =0 if ((exists $_host{port}) && ($_host{port} ne $port)); |
40
|
0
|
0
|
|
|
|
|
if ($f_match) { |
41
|
0
|
0
|
|
|
|
|
$tmp_id = $_host{applicationId} if exists $_host{applicationId}; |
42
|
0
|
0
|
|
|
|
|
$tmp_authtype = $_host{authType} if exists $_host{authType}; |
43
|
0
|
0
|
|
|
|
|
$tmp_require = $_host{requireSession} if exists $_host{requireSession}; |
44
|
0
|
0
|
|
|
|
|
$tmp_export = $_host{exportAssertion} if exists $_host{exportAssertion}; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
0
|
|
|
|
|
|
my @w_path ; |
48
|
0
|
0
|
|
|
|
|
@w_path = @$ref_of_array_of_path if $ref_of_array_of_path; |
49
|
0
|
|
|
|
|
|
while (@w_path) { |
50
|
0
|
|
|
|
|
|
my $_p = shift @w_path ; |
51
|
0
|
0
|
|
|
|
|
if ( $_host{Path}->{name} eq $_p) { |
52
|
0
|
0
|
|
|
|
|
$tmp_id = $_host{Path}->{applicationId} if exists $_host{Path}->{applicationId}; |
53
|
0
|
0
|
|
|
|
|
$tmp_authtype = $_host{Path}->{authType} if exists $_host{Path}->{authType}; |
54
|
0
|
0
|
|
|
|
|
$tmp_require = $_host{Path}->{requireSession} if exists $_host{Path}->{requireSession}; |
55
|
0
|
0
|
|
|
|
|
$tmp_export = $_host{Path}->{exportAssertion} if exists $_host{Path}->{exportAssertion}; |
56
|
0
|
|
|
|
|
|
my $tmp =$_host{Path}; |
57
|
0
|
|
|
|
|
|
%_host =%$tmp ; |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
# descendre |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
else |
62
|
|
|
|
|
|
|
{ |
63
|
0
|
|
|
|
|
|
last ; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
} |
69
|
0
|
0
|
|
|
|
|
$self->{application_id} =$tmp_id if $tmp_id; |
70
|
0
|
0
|
|
|
|
|
$self->{authtype} = $tmp_authtype if $tmp_authtype; |
71
|
0
|
0
|
|
|
|
|
$self->{require}= $tmp_require if $tmp_require; |
72
|
0
|
0
|
|
|
|
|
$self->{export}= $tmp_export if $tmp_export; |
73
|
0
|
|
|
|
|
|
return $self->{application_id}; |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
sub redirection { |
76
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
77
|
0
|
0
|
|
|
|
|
if (!$self->{application_id}) |
78
|
0
|
|
|
|
|
|
{ $self->application_id($self); |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
## |
81
|
0
|
|
|
|
|
|
my $application_id =$self->{application_id}; |
82
|
0
|
|
|
|
|
|
my $providerid; |
83
|
|
|
|
|
|
|
my $shire ; |
84
|
0
|
|
|
|
|
|
my $idp ; |
85
|
0
|
|
|
|
|
|
$shire = $self->{xml_application}->{shire} ; |
86
|
0
|
0
|
|
|
|
|
$shire = $self->{xml_application}->{Application}{$application_id}{shire} if |
87
|
|
|
|
|
|
|
(exists ($self->{xml_application}->{Application}{$application_id}{shire})) ; |
88
|
0
|
|
|
|
|
|
$idp = $self->{xml_application}->{IdpURL} ; |
89
|
0
|
0
|
|
|
|
|
$idp = $self->{xml_application}->{Application}{$application_id}{IdpURL} if |
90
|
|
|
|
|
|
|
(exists ($self->{xml_application}->{Application}{$application_id}{IdpURL})) ; |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
|
93
|
0
|
|
|
|
|
|
$providerid= $self->{xml_application}->{Application}{$application_id}{providerId} ; |
94
|
0
|
|
|
|
|
|
$self->{providerID} = $providerid; |
95
|
0
|
|
|
|
|
|
$self->{shire} = $shire ; |
96
|
0
|
|
|
|
|
|
my $target= $self->{uri}; |
97
|
0
|
|
|
|
|
|
$target = uri_escape($target); |
98
|
0
|
|
|
|
|
|
$shire = uri_escape($shire); |
99
|
0
|
|
|
|
|
|
$providerid = uri_escape($providerid); |
100
|
|
|
|
|
|
|
|
101
|
0
|
|
|
|
|
|
my $redirection=$idp."?target=".$target."&shire=".$shire."&providerId=".$providerid ; |
102
|
0
|
|
|
|
|
|
$self->{redirection}= $redirection; |
103
|
0
|
|
|
|
|
|
return $redirection ; |
104
|
|
|
|
|
|
|
} |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
1; |