|  | @@ 154-175 (lines=22) @@ | 
                                                            
                                    | 151 |  |     /** | 
                                                            
                                    | 152 |  |      * @When /^([^\']*) starts an SFO authentication$/ | 
                                                            
                                    | 153 |  |      */ | 
                                                            
                                    | 154 |  |     public function iStartAnSFOAuthentication($nameId) | 
                                                            
                                    | 155 |  |     { | 
                                                            
                                    | 156 |  |         $authnRequest = new AuthnRequest(); | 
                                                            
                                    | 157 |  |         // In order to later assert if the response succeeded or failed, set our own dummy ACS location | 
                                                            
                                    | 158 |  |         $authnRequest->setAssertionConsumerServiceURL(SamlEntityRepository::SP_ACS_LOCATION); | 
                                                            
                                    | 159 |  |         $authnRequest->setIssuer($this->currentSfoSp['entityId']); | 
                                                            
                                    | 160 |  |         $authnRequest->setDestination(self::SFO_ENDPOINT_URL); | 
                                                            
                                    | 161 |  |         $authnRequest->setProtocolBinding(Constants::BINDING_HTTP_REDIRECT); | 
                                                            
                                    | 162 |  |         $authnRequest->setNameId($this->buildNameId($nameId)); | 
                                                            
                                    | 163 |  |         // Sign with random key, does not mather for now. | 
                                                            
                                    | 164 |  |         // todo: use from services_test.yml | 
                                                            
                                    | 165 |  |         $authnRequest->setSignatureKey( | 
                                                            
                                    | 166 |  |             $this->loadPrivateKey(new PrivateKey('/var/www/ci/certificates/sp.pem', 'default')) | 
                                                            
                                    | 167 |  |         ); | 
                                                            
                                    | 168 |  |         $authnRequest->setRequestedAuthnContext( | 
                                                            
                                    | 169 |  |             ['AuthnContextClassRef' => ['http://stepup.example.com/assurance/sfo-level2']] | 
                                                            
                                    | 170 |  |         ); | 
                                                            
                                    | 171 |  |         $request = Saml2AuthnRequest::createNew($authnRequest); | 
                                                            
                                    | 172 |  |         $query = $request->buildRequestQuery(); | 
                                                            
                                    | 173 |  |  | 
                                                            
                                    | 174 |  |         $this->getSession()->visit($request->getDestination().'?'.$query); | 
                                                            
                                    | 175 |  |     } | 
                                                            
                                    | 176 |  |  | 
                                                            
                                    | 177 |  |     /** | 
                                                            
                                    | 178 |  |      * @When /^([^\']*) starts an SFO authentication requiring ([^\']*)$/ | 
                                                                                
                                |  | @@ 180-201 (lines=22) @@ | 
                                                            
                                    | 177 |  |     /** | 
                                                            
                                    | 178 |  |      * @When /^([^\']*) starts an SFO authentication requiring ([^\']*)$/ | 
                                                            
                                    | 179 |  |      */ | 
                                                            
                                    | 180 |  |     public function iStartAnSFOAuthenticationWithLoaRequirement($nameId, $loa) | 
                                                            
                                    | 181 |  |     { | 
                                                            
                                    | 182 |  |         $authnRequest = new AuthnRequest(); | 
                                                            
                                    | 183 |  |         // In order to later assert if the response succeeded or failed, set our own dummy ACS location | 
                                                            
                                    | 184 |  |         $authnRequest->setAssertionConsumerServiceURL(SamlEntityRepository::SP_ACS_LOCATION); | 
                                                            
                                    | 185 |  |         $authnRequest->setIssuer($this->currentSfoSp['entityId']); | 
                                                            
                                    | 186 |  |         $authnRequest->setDestination(self::SFO_ENDPOINT_URL); | 
                                                            
                                    | 187 |  |         $authnRequest->setProtocolBinding(Constants::BINDING_HTTP_REDIRECT); | 
                                                            
                                    | 188 |  |         $authnRequest->setNameId($this->buildNameId($nameId)); | 
                                                            
                                    | 189 |  |         // Sign with random key, does not mather for now. | 
                                                            
                                    | 190 |  |         // todo: use from services_test.yml | 
                                                            
                                    | 191 |  |         $authnRequest->setSignatureKey( | 
                                                            
                                    | 192 |  |             $this->loadPrivateKey(new PrivateKey('/var/www/ci/certificates/sp.pem', 'default')) | 
                                                            
                                    | 193 |  |         ); | 
                                                            
                                    | 194 |  |         $authnRequest->setRequestedAuthnContext( | 
                                                            
                                    | 195 |  |             ['AuthnContextClassRef' => [$loa]] | 
                                                            
                                    | 196 |  |         ); | 
                                                            
                                    | 197 |  |         $request = Saml2AuthnRequest::createNew($authnRequest); | 
                                                            
                                    | 198 |  |         $query = $request->buildRequestQuery(); | 
                                                            
                                    | 199 |  |  | 
                                                            
                                    | 200 |  |         $this->getSession()->visit($request->getDestination().'?'.$query); | 
                                                            
                                    | 201 |  |     } | 
                                                            
                                    | 202 |  |  | 
                                                            
                                    | 203 |  |     /** | 
                                                            
                                    | 204 |  |      * @When /^([^\']*) starts an authentication$/ | 
                                                                                
                                |  | @@ 206-224 (lines=19) @@ | 
                                                            
                                    | 203 |  |     /** | 
                                                            
                                    | 204 |  |      * @When /^([^\']*) starts an authentication$/ | 
                                                            
                                    | 205 |  |      */ | 
                                                            
                                    | 206 |  |     public function iStartAnAuthentication($nameId) | 
                                                            
                                    | 207 |  |     { | 
                                                            
                                    | 208 |  |         $authnRequest = new AuthnRequest(); | 
                                                            
                                    | 209 |  |         // In order to later assert if the response succeeded or failed, set our own dummy ACS location | 
                                                            
                                    | 210 |  |         $authnRequest->setAssertionConsumerServiceURL(SamlEntityRepository::SP_ACS_LOCATION); | 
                                                            
                                    | 211 |  |         $authnRequest->setIssuer($this->currentSp['entityId']); | 
                                                            
                                    | 212 |  |         $authnRequest->setDestination(self::SSO_ENDPOINT_URL); | 
                                                            
                                    | 213 |  |         $authnRequest->setProtocolBinding(Constants::BINDING_HTTP_REDIRECT); | 
                                                            
                                    | 214 |  |         $authnRequest->setNameId($this->buildNameId($nameId)); | 
                                                            
                                    | 215 |  |         $authnRequest->setSignatureKey( | 
                                                            
                                    | 216 |  |             $this->loadPrivateKey(new PrivateKey('/var/www/ci/certificates/sp.pem', 'default')) | 
                                                            
                                    | 217 |  |         ); | 
                                                            
                                    | 218 |  |         $authnRequest->setRequestedAuthnContext( | 
                                                            
                                    | 219 |  |             ['AuthnContextClassRef' => ['http://stepup.example.com/assurance/level2']] | 
                                                            
                                    | 220 |  |         ); | 
                                                            
                                    | 221 |  |         $request = Saml2AuthnRequest::createNew($authnRequest); | 
                                                            
                                    | 222 |  |         $query = $request->buildRequestQuery(); | 
                                                            
                                    | 223 |  |         $this->getSession()->visit($request->getDestination().'?'.$query); | 
                                                            
                                    | 224 |  |     } | 
                                                            
                                    | 225 |  |  | 
                                                            
                                    | 226 |  |     /** | 
                                                            
                                    | 227 |  |      * @When /^([^\']*) starts an authentication requiring ([^\']*)$/ | 
                                                                                
                                |  | @@ 229-247 (lines=19) @@ | 
                                                            
                                    | 226 |  |     /** | 
                                                            
                                    | 227 |  |      * @When /^([^\']*) starts an authentication requiring ([^\']*)$/ | 
                                                            
                                    | 228 |  |      */ | 
                                                            
                                    | 229 |  |     public function iStartAnSsoAuthenticationWithLoaRequirement($nameId, $loa) | 
                                                            
                                    | 230 |  |     { | 
                                                            
                                    | 231 |  |         $authnRequest = new AuthnRequest(); | 
                                                            
                                    | 232 |  |         // In order to later assert if the response succeeded or failed, set our own dummy ACS location | 
                                                            
                                    | 233 |  |         $authnRequest->setAssertionConsumerServiceURL(SamlEntityRepository::SP_ACS_LOCATION); | 
                                                            
                                    | 234 |  |         $authnRequest->setIssuer($this->currentSp['entityId']); | 
                                                            
                                    | 235 |  |         $authnRequest->setDestination(self::SSO_ENDPOINT_URL); | 
                                                            
                                    | 236 |  |         $authnRequest->setProtocolBinding(Constants::BINDING_HTTP_REDIRECT); | 
                                                            
                                    | 237 |  |         $authnRequest->setNameId($this->buildNameId($nameId)); | 
                                                            
                                    | 238 |  |         $authnRequest->setSignatureKey( | 
                                                            
                                    | 239 |  |             $this->loadPrivateKey(new PrivateKey('/var/www/ci/certificates/sp.pem', 'default')) | 
                                                            
                                    | 240 |  |         ); | 
                                                            
                                    | 241 |  |         $authnRequest->setRequestedAuthnContext( | 
                                                            
                                    | 242 |  |             ['AuthnContextClassRef' => [$loa]] | 
                                                            
                                    | 243 |  |         ); | 
                                                            
                                    | 244 |  |         $request = Saml2AuthnRequest::createNew($authnRequest); | 
                                                            
                                    | 245 |  |         $query = $request->buildRequestQuery(); | 
                                                            
                                    | 246 |  |         $this->getSession()->visit($request->getDestination().'?'.$query); | 
                                                            
                                    | 247 |  |     } | 
                                                            
                                    | 248 |  |  | 
                                                            
                                    | 249 |  |     /** | 
                                                            
                                    | 250 |  |      * @When /^I authenticate at the IdP as ([^\']*)$/ |