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