@@ -49,9 +49,6 @@ class PerunIdentity extends \SimpleSAML\Auth\ProcessingFilter
4949 const TARGET_EXTENDED = 'targetextended ' ;
5050 const INTERFACE_PROPNAME = 'interface ' ;
5151 const SOURCE_IDP_ENTITY_ID_ATTR = 'sourceIdPEntityIDAttr ' ;
52- const FORCE_REGISTRATION_TO_GROUPS = 'forceRegistrationToGroups ' ;
53- const CHECK_GROUP_MEMBERSHIP = 'checkGroupMembership ' ;
54- const ALLOW_REGISTRATION_TO_GROUPS = 'allowRegistrationToGroups ' ;
5552 const PERUN_FACILITY_CHECK_GROUP_MEMBERSHIP_ATTR = 'facilityCheckGroupMembershipAttr ' ;
5653 const PERUN_FACILITY_VO_SHORT_NAMES_ATTR = 'facilityVoShortNamesAttr ' ;
5754 const PERUN_FACILITY_DYNAMIC_REGISTRATION_ATTR = 'facilityDynamicRegistrationAttr ' ;
@@ -61,15 +58,14 @@ class PerunIdentity extends \SimpleSAML\Auth\ProcessingFilter
6158
6259 private $ uidsAttr ;
6360 private $ registerUrlBase ;
64- private $ registerUrl = null ;
61+ private $ registerUrl ;
6562 private $ defaultRegisterUrl ;
6663 private $ voShortName ;
6764 private $ facilityVoShortNames = [];
6865 private $ listOfSpsWithoutInfoAboutRedirection = [];
6966 private $ spEntityId ;
7067 private $ interface ;
7168 private $ checkGroupMembership = false ;
72- private $ forceRegistrationToGroups = false ;
7369 private $ allowRegistrationToGroups ;
7470 private $ dynamicRegistration ;
7571 private $ sourceIdPEntityIDAttr ;
@@ -93,85 +89,77 @@ class PerunIdentity extends \SimpleSAML\Auth\ProcessingFilter
9389 public function __construct ($ config , $ reserved )
9490 {
9591 parent ::__construct ($ config , $ reserved );
92+ $ config = Configuration::loadFromArray ($ config );
93+
94+ $ this ->uidsAttr = $ config ->getArray (self ::UIDS_ATTR , []);
95+ $ this ->registerUrlBase = $ config ->getString (self ::REGISTER_URL_BASE , null );
96+ $ this ->defaultRegisterUrl = $ config ->getString (self ::REGISTER_URL , null );
97+ $ this ->voShortName = $ config ->getString (self ::VO_SHORTNAME , null );
98+ $ this ->interface = $ config ->getString (self ::INTERFACE_PROPNAME , AdapterRpc::RPC );
99+ $ this ->sourceIdPEntityIDAttr =
100+ $ config ->getString (self ::SOURCE_IDP_ENTITY_ID_ATTR , 'sourceIdPEntityID ' );
101+ $ this ->facilityCheckGroupMembershipAttr =
102+ $ config ->getString (self ::PERUN_FACILITY_CHECK_GROUP_MEMBERSHIP_ATTR , null );
103+ $ this ->facilityDynamicRegistrationAttr =
104+ $ config ->getString (self ::PERUN_FACILITY_DYNAMIC_REGISTRATION_ATTR , null );
105+ $ this ->facilityVoShortNamesAttr =
106+ $ config ->getString (self ::PERUN_FACILITY_VO_SHORT_NAMES_ATTR , null );
107+ $ this ->facilityRegisterUrlAttr = $ config ->getString (self ::PERUN_FACILITY_REGISTER_URL_ATTR , null );
108+ $ this ->facilityAllowRegistrationToGroupsAttr =
109+ $ config ->getString (self ::PERUN_FACILITY_ALLOW_REGISTRATION_TO_GROUPS , null );
110+ $ this ->listOfSpsWithoutInfoAboutRedirection =
111+ $ config ->getArray (self ::LIST_OF_SPS_WITHOUT_INFO_ABOUT_REDIRECTION , []);
96112
97- if (! isset ( $ config [ self :: UIDS_ATTR ] )) {
113+ if (is_null ( $ this -> uidsAttr )) {
98114 throw new Exception (
99115 'perun:PerunIdentity: missing mandatory config option \'' . self ::UIDS_ATTR . '\'. '
100116 );
101117 }
102- if (! isset ( $ config [ self :: REGISTER_URL_BASE ] )) {
118+ if (is_null ( $ this -> registerUrlBase )) {
103119 throw new Exception (
104120 'perun:PerunIdentity: missing mandatory config option \'' . self ::REGISTER_URL_BASE . '\'. '
105121 );
106122 }
107- if (! isset ( $ config [ self :: REGISTER_URL ] )) {
123+ if (is_null ( $ this -> defaultRegisterUrl )) {
108124 throw new Exception (
109125 'perun:PerunIdentity: missing mandatory config option \'' . self ::REGISTER_URL . '\'. '
110126 );
111127 }
112- if (! isset ( $ config [ self :: VO_SHORTNAME ] )) {
128+ if (is_null ( $ this -> voShortName )) {
113129 throw new Exception (
114130 'perun:PerunIdentity: missing mandatory config option \'' . self ::VO_SHORTNAME . '\'. '
115131 );
116132 }
117- if (! isset ( $ config [ self :: PERUN_FACILITY_CHECK_GROUP_MEMBERSHIP_ATTR ] )) {
133+ if (is_null ( $ this -> facilityCheckGroupMembershipAttr )) {
118134 throw new Exception (
119135 'perun:PerunIdentity: missing mandatory config option \'' .
120136 self ::PERUN_FACILITY_CHECK_GROUP_MEMBERSHIP_ATTR . '\'. '
121137 );
122138 }
123- if (! isset ( $ config [ self :: PERUN_FACILITY_DYNAMIC_REGISTRATION_ATTR ] )) {
139+ if (is_null ( $ this -> facilityDynamicRegistrationAttr )) {
124140 throw new Exception (
125141 'perun:PerunIdentity: missing mandatory config option \'' .
126142 self ::PERUN_FACILITY_DYNAMIC_REGISTRATION_ATTR . '\'. '
127143 );
128144 }
129- if (! isset ( $ config [ self :: PERUN_FACILITY_VO_SHORT_NAMES_ATTR ] )) {
145+ if (is_null ( $ this -> facilityVoShortNamesAttr )) {
130146 throw new Exception (
131147 'perun:PerunIdentity: missing mandatory config option \'' .
132148 self ::PERUN_FACILITY_VO_SHORT_NAMES_ATTR . '\'. '
133149 );
134150 }
135- if (! isset ( $ config [ self :: PERUN_FACILITY_REGISTER_URL_ATTR ] )) {
151+ if (is_null ( $ this -> facilityRegisterUrlAttr )) {
136152 throw new Exception (
137153 'perun:PerunIdentity: missing mandatory config option \'' .
138154 self ::PERUN_FACILITY_REGISTER_URL_ATTR . '\'. '
139155 );
140156 }
141- if (! isset ( $ config [ self :: PERUN_FACILITY_ALLOW_REGISTRATION_TO_GROUPS ] )) {
157+ if (is_null ( $ this -> facilityAllowRegistrationToGroupsAttr )) {
142158 throw new Exception (
143159 "perun:PerunIdentity: missing mandatory config option ' " .
144160 self ::PERUN_FACILITY_ALLOW_REGISTRATION_TO_GROUPS . "'. "
145161 );
146162 }
147- if (!isset ($ config [self ::INTERFACE_PROPNAME ])) {
148- $ config [self ::INTERFACE_PROPNAME ] = Adapter::RPC ;
149- }
150- if (!isset ($ config [self ::SOURCE_IDP_ENTITY_ID_ATTR ])) {
151- $ config [self ::SOURCE_IDP_ENTITY_ID_ATTR ] = RetainIdPEntityID::DEFAULT_ATTR_NAME ;
152- }
153- if (!isset ($ config [self ::FORCE_REGISTRATION_TO_GROUPS ])) {
154- $ config [self ::FORCE_REGISTRATION_TO_GROUPS ] = false ;
155- }
156- if (isset ($ config [self ::LIST_OF_SPS_WITHOUT_INFO_ABOUT_REDIRECTION ]) &&
157- is_array ($ config [self ::LIST_OF_SPS_WITHOUT_INFO_ABOUT_REDIRECTION ])) {
158- $ this ->listOfSpsWithoutInfoAboutRedirection = $ config [self ::LIST_OF_SPS_WITHOUT_INFO_ABOUT_REDIRECTION ];
159- }
160-
161- $ this ->uidsAttr = $ config [self ::UIDS_ATTR ];
162- $ this ->registerUrlBase = (string )$ config [self ::REGISTER_URL_BASE ];
163- $ this ->defaultRegisterUrl = (string )$ config [self ::REGISTER_URL ];
164- $ this ->voShortName = $ config [self ::VO_SHORTNAME ];
165- $ this ->interface = (string )$ config [self ::INTERFACE_PROPNAME ];
166- $ this ->sourceIdPEntityIDAttr = $ config [self ::SOURCE_IDP_ENTITY_ID_ATTR ];
167- $ this ->forceRegistrationToGroups = $ config [self ::FORCE_REGISTRATION_TO_GROUPS ];
168-
169- $ this ->facilityCheckGroupMembershipAttr = (string )$ config [self ::PERUN_FACILITY_CHECK_GROUP_MEMBERSHIP_ATTR ];
170- $ this ->facilityDynamicRegistrationAttr = (string )$ config [self ::PERUN_FACILITY_DYNAMIC_REGISTRATION_ATTR ];
171- $ this ->facilityVoShortNamesAttr = (string )$ config [self ::PERUN_FACILITY_VO_SHORT_NAMES_ATTR ];
172- $ this ->facilityRegisterUrlAttr = (string )$ config [self ::PERUN_FACILITY_REGISTER_URL_ATTR ];
173- $ this ->facilityAllowRegistrationToGroupsAttr =
174- (string ) $ config [self ::PERUN_FACILITY_ALLOW_REGISTRATION_TO_GROUPS ];
175163
176164 $ this ->adapter = Adapter::getInstance ($ this ->interface );
177165 $ this ->rpcAdapter = new AdapterRpc ();
0 commit comments