-
Notifications
You must be signed in to change notification settings - Fork 2
/
app-scope.patch
61 lines (60 loc) · 2.84 KB
/
app-scope.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
diff --git a/usr/share/perl5/Lemonldap/NG/Portal/Issuer/OpenIDConnect.pm b/usr/share/perl5/Lemonldap/NG/Portal/Issuer/OpenIDConnect.pm
index 96aea34..1c9a752 100644
--- a/usr/share/perl5/Lemonldap/NG/Portal/Issuer/OpenIDConnect.pm
+++ b/usr/share/perl5/Lemonldap/NG/Portal/Issuer/OpenIDConnect.pm
@@ -798,6 +798,7 @@ sub _authorizeEndpoint {
address => 'yourAddress',
phone => 'yourPhone',
offline_access => 'yourOffline',
+ applications => 'yourApps',
};
my @list;
foreach my $requested_scope ( split( /\s+/, $scope ) ) {
diff --git a/usr/share/perl5/Lemonldap/NG/Portal/Lib/OpenIDConnect.pm b/usr/share/perl5/Lemonldap/NG/Portal/Lib/OpenIDConnect.pm
index 964c85b..1ea1096 100644
--- a/usr/share/perl5/Lemonldap/NG/Portal/Lib/OpenIDConnect.pm
+++ b/usr/share/perl5/Lemonldap/NG/Portal/Lib/OpenIDConnect.pm
@@ -148,6 +148,9 @@ sub load_rp {
# Handle scopes
# this HAS to be a deep copy of the DEFAULT_SCOPES hashref!
my $scope_values = { %{ DEFAULT_SCOPES() } };
+ if ( $config{options}->{oidcRPMetaDataOptionsAllowScopeApplications} ) {
+ $scope_values->{applications} = [];
+ }
# Additional claims
my $extraClaims = $config{extraClaims};
@@ -2117,10 +2120,34 @@ sub buildUserInfoResponseFromData {
# Else, iterate through scopes to find allowed attributes
}
else {
+ my $basePath = $self->conf->{portal};
+ $basePath =~ s#/*$##;
+ $basePath .= $self->p->{staticPrefix} . '/common/apps/';
foreach my $scope_value ( split( /\s/, $scope ) ) {
next if ( $scope_value eq "openid" );
$self->logger->debug(
"Get attributes linked to scope value $scope_value");
+ if ( $scope_value eq 'applications' ) {
+ if ( $self->rpScopes->{$rp}->{applications} ) {
+ my @applist = map {
+ my @apps = map {
+ $_->{applogo} =
+ $_->{applogo_icon}
+ ? $_->{applogo}
+ : $basePath . $_->{applogo};
+ $_;
+ } @{ $_->{applications} };
+ $_->{applications}
+ } @{ $self->p->menu->appslist($req) };
+ $userinfo_response->{applications} =
+ JSON::to_json( \@applist );
+ }
+ else {
+ $self->userLogger->error(
+ 'Try to access to applications scopes without right');
+ }
+ next;
+ }
my $list =
$self->getAttributesListFromScopeValue( $rp, $scope_value );
$self->logger->debug(