Skip to content

Commit

Permalink
AUT-1523 Fix cookie names to comply with Ory Hydra 2.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
alarkvell committed Nov 24, 2023
1 parent c63e5c3 commit 19ef356
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/main/groovy/ee/ria/specificproxyservice/Requests.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ class Requests {
return given()
.filter(flow.cookieFilter)
.filter(new AllureRestAssured())
.cookie("__Host-oauth2_authentication_csrf_1316479801", flow.oauth2_authentication_csrf)
.cookie("__Host-oauth2_consent_csrf_1316479801", flow.oauth2_consent_csrf)
.cookie("__Host-ory_hydra_login_csrf_1316479801", flow.oauth2_authentication_csrf)
.cookie("__Host-ory_hydra_consent_csrf_1316479801", flow.oauth2_consent_csrf)
.relaxedHTTPSValidation()
.when()
.redirects().follow(false)
Expand Down
6 changes: 3 additions & 3 deletions src/main/groovy/ee/ria/specificproxyservice/Steps.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ class Steps {

Response authenticationResponse = Requests.startAuthenticationFlowInTara(flow, taraUrl)
String location = authenticationResponse.then().extract().response().getHeader("location")
flow.setOauth2_authentication_csrf(authenticationResponse.getCookie("__Host-oauth2_authentication_csrf_1316479801"))
flow.setOauth2_authentication_csrf(authenticationResponse.getCookie("__Host-ory_hydra_login_csrf_1316479801"))
URL locationUrl = new URL(location)
String baseUrl = locationUrl.getProtocol() + "://" + (locationUrl.getPort() > 0 ? (":" + locationUrl.getPort()) : "") + locationUrl.getHost()
flow.specificProxyService.setTaraBaseUrl(baseUrl)
Expand Down Expand Up @@ -191,7 +191,7 @@ class Steps {
@Step("User consents with authentication")
static Response userConsentAndFollowRedirects(Flow flow, Response response) {
Response response1 = Requests.followRedirectWithCsrfCookie(flow, response.getHeader("location"))
flow.setOauth2_consent_csrf(response1.getCookie("__Host-oauth2_consent_csrf_1316479801"))
flow.setOauth2_consent_csrf(response1.getCookie("__Host-ory_hydra_consent_csrf_1316479801"))
Requests.followRedirect(flow, response1.getHeader("location"))

Response response2 = Requests.consentSubmit(flow, flow.specificProxyService.taraBaseUrl + "/auth/consent/confirm", true)
Expand All @@ -202,7 +202,7 @@ class Steps {
@Step("User do not consent with authentication")
static Response userDenyConsentAndFollowRedirects(Flow flow, Response response) {
Response response1 = Requests.followRedirectWithCsrfCookie(flow, response.getHeader("location"))
flow.setOauth2_consent_csrf(response1.getCookie("__Host-oauth2_consent_csrf_1316479801"))
flow.setOauth2_consent_csrf(response1.getCookie("__Host-ory_hydra_consent_csrf_1316479801"))
Requests.followRedirect(flow, response1.getHeader("location"))

Response response2 = Requests.consentSubmit(flow, flow.specificProxyService.taraBaseUrl + "/auth/consent/confirm", false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class UserConsentSpec extends SpecificProxyServiceSpecification {
Response taraInitResponse = Steps.startAuthProcessInTara(flow, specificProxyResponse)
Response response = Steps.authenticateWithMidAndFollowRedirects(flow, taraInitResponse)
Response response2 = Requests.followRedirectWithCsrfCookie(flow, response.getHeader("location"))
flow.setOauth2_consent_csrf(response2.getCookie("__Host-oauth2_consent_csrf_1316479801"))
flow.setOauth2_consent_csrf(response2.getCookie("__Host-ory_hydra_consent_csrf_1316479801"))

Response consentViewResponse = Requests.followRedirect(flow, response2.getHeader("location"))

Expand All @@ -53,7 +53,7 @@ class UserConsentSpec extends SpecificProxyServiceSpecification {
Response legalPersonSelectionResponse = Steps.selectLegalEntity(flow, getLegalEntityListResponse.body().jsonPath().get("legalPersons[0].legalPersonIdentifier"))
String legalName = getLegalEntityListResponse.body().jsonPath().get("legalPersons[0].legalName")
Response response2 = Requests.followRedirectWithCsrfCookie(flow, legalPersonSelectionResponse.getHeader("location"))
flow.setOauth2_consent_csrf(response2.getCookie("__Host-oauth2_consent_csrf_1316479801"))
flow.setOauth2_consent_csrf(response2.getCookie("__Host-ory_hydra_consent_csrf_1316479801"))

Response consentViewResponse = Requests.followRedirect(flow, response2.getHeader("location"))

Expand Down

0 comments on commit 19ef356

Please # to comment.