11<?php
22
3+ declare (strict_types=1 );
4+
35namespace SimpleSAML \Module \perun \Auth \Process ;
46
57use SimpleSAML \Auth \ProcessingFilter ;
1517
1618class PerunEnsureMember extends ProcessingFilter
1719{
18- const LOG_PREFIX = 'perun:PerunEnsureMember: ' ;
20+ public const LOG_PREFIX = 'perun:PerunEnsureMember: ' ;
1921
20- const REGISTER_URL = 'registerUrl ' ;
21- const VO_SHORT_NAME = 'voShortName ' ;
22- const GROUP_NAME = 'groupName ' ;
23- const INTERFACE_PROPNAME = 'interface ' ;
24- const CALLBACK_PARAMETER_NAME = 'callbackParameterName ' ;
25- const RPC = 'rpc ' ;
22+ public const REGISTER_URL = 'registerUrl ' ;
23+ public const VO_SHORT_NAME = 'voShortName ' ;
24+ public const GROUP_NAME = 'groupName ' ;
25+ public const INTERFACE_PROPNAME = 'interface ' ;
26+ public const CALLBACK_PARAMETER_NAME = 'callbackParameterName ' ;
27+ public const RPC = 'rpc ' ;
2628
27- const CALLBACK = 'perun/perun_ensure_member_callback.php ' ;
28- const REDIRECT = 'perun/perun_ensure_member.php ' ;
29+ public const CALLBACK = 'perun/perun_ensure_member_callback.php ' ;
30+ public const REDIRECT = 'perun/perun_ensure_member.php ' ;
2931
3032 public const STAGE = 'perun:PerunEnsureMember ' ;
3133 public const PARAM_STATE_ID = PerunConstants::STATE_ID ;
@@ -46,7 +48,7 @@ public function __construct($config, $reserved)
4648 parent ::__construct ($ config , $ reserved );
4749 $ this ->config = $ config ;
4850 $ this ->filterConfig = Configuration::loadFromArray ($ config );
49-
51+
5052 $ this ->registerUrl = $ this ->filterConfig ->getString (self ::REGISTER_URL , '' );
5153 if (empty ($ this ->registerUrl )) {
5254 throw new Exception (self ::LOG_PREFIX . 'Missing configuration option \'' . self ::REGISTER_URL . '\'' );
@@ -59,7 +61,9 @@ public function __construct($config, $reserved)
5961
6062 $ this ->callbackParameterName = $ this ->filterConfig ->getString (self ::CALLBACK_PARAMETER_NAME , '' );
6163 if (empty ($ this ->callbackParameterName )) {
62- throw new Exception (self ::LOG_PREFIX . 'Missing configuration option \'' . self ::CALLBACK_PARAMETER_NAME . '\'' );
64+ throw new Exception (
65+ self ::LOG_PREFIX . 'Missing configuration option \'' . self ::CALLBACK_PARAMETER_NAME . '\''
66+ );
6367 }
6468
6569 $ this ->groupName = $ this ->filterConfig ->getString (self ::GROUP_NAME , '' );
@@ -96,6 +100,7 @@ private function handleUser($user, $vo, $request): void
96100
97101 if (Member::VALID === $ memberStatus && $ isUserInGroup ) {
98102 Logger::debug (self ::LOG_PREFIX . 'User is allowed to continue ' );
103+
99104 return ;
100105 }
101106
@@ -106,22 +111,32 @@ private function handleUser($user, $vo, $request): void
106111 if (Member::VALID === $ memberStatus && $ isUserInGroup ) {
107112 Logger::debug (self ::LOG_PREFIX . 'User is allowed to continue ' );
108113 } elseif (Member::VALID === $ memberStatus && !$ isUserInGroup && $ groupHasRegistrationForm ) {
109- Logger::debug (self ::LOG_PREFIX . 'User is not valid in group ' . $ this ->groupName . ' - sending to registration ' );
114+ Logger::debug (
115+ self ::LOG_PREFIX . 'User is not valid in group ' . $ this ->groupName . ' - sending to registration '
116+ );
110117 $ this ->register ($ request , $ this ->groupName );
111118 } elseif (null === $ memberStatus && $ voHasRegistrationForm && $ isUserInGroup ) {
112- Logger::debug (self ::LOG_PREFIX . 'User is not member of vo ' . $ this ->voShortName . ' - sending to registration ' );
119+ Logger::debug (
120+ self ::LOG_PREFIX . 'User is not member of vo ' . $ this ->voShortName . ' - sending to registration '
121+ );
113122 $ this ->register ($ request );
114123 } elseif (null === $ memberStatus && $ voHasRegistrationForm && !$ isUserInGroup && $ groupHasRegistrationForm ) {
115- Logger::debug (self ::LOG_PREFIX . 'User is not member of vo ' . $ this ->voShortName . ' - sending to registration ' );
124+ Logger::debug (
125+ self ::LOG_PREFIX . 'User is not member of vo ' . $ this ->voShortName . ' - sending to registration '
126+ );
116127 $ this ->register ($ request , $ this ->groupName );
117128 } elseif (Member::EXPIRED === $ memberStatus && $ voHasRegistrationForm && $ isUserInGroup ) {
118129 Logger::debug (self ::LOG_PREFIX . 'User is expired - sending to registration ' );
119130 $ this ->register ($ request );
120131 } elseif (Member::EXPIRED === $ memberStatus && $ voHasRegistrationForm && !$ isUserInGroup && $ groupHasRegistrationForm ) {
121- Logger::debug (self ::LOG_PREFIX . 'User is expired and is not in group ' . $ this ->groupName . ' - sending to registration ' );
132+ Logger::debug (
133+ self ::LOG_PREFIX . 'User is expired and is not in group ' . $ this ->groupName . ' - sending to registration '
134+ );
122135 $ this ->register ($ request , $ this ->groupName );
123136 } else {
124- Logger::debug (self ::LOG_PREFIX . 'User is not valid in vo/group and cannot be sent to the registration - sending to unauthorized ' );
137+ Logger::debug (
138+ self ::LOG_PREFIX . 'User is not valid in vo/group and cannot be sent to the registration - sending to unauthorized '
139+ );
125140 PerunIdentity::unauthorized ($ request );
126141 }
127142 }
0 commit comments