Skip to content

Commit

Permalink
fixup: revert E2E for dynamic client reg
Browse files Browse the repository at this point in the history
  • Loading branch information
hperl committed Feb 28, 2023
1 parent 269e050 commit 0b24070
Showing 1 changed file with 33 additions and 42 deletions.
75 changes: 33 additions & 42 deletions cypress/integration/openid/dynamic_client_registration.js
Original file line number Diff line number Diff line change
@@ -1,50 +1,41 @@
// Copyright © 2022 Ory Corp
// SPDX-License-Identifier: Apache-2.0

const accessTokenStrategies = ["opaque", "jwt"]

describe("OAuth2 / OpenID Connect Dynamic Client Registration", function () {
accessTokenStrategies.forEach((accessTokenStrategy) => {
describe("access_token_strategy=" + accessTokenStrategy, function () {
it("should return same client_secret given in request for newly created clients with client_secret specified", function () {
cy.request({
method: "POST",
url: Cypress.env("public_url") + "/oauth2/register",
body: {
client_name: "clientName",
scope: "foo openid offline_access",
grant_types: ["client_credentials"],
access_token_strategy: accessTokenStrategy,
},
}).then((response) => {
expect(response.body.registration_access_token).to.not.be.empty
})
})
it("should return same client_secret given in request for newly created clients with client_secret specified", function () {
cy.request({
method: "POST",
url: Cypress.env("public_url") + "/oauth2/register",
body: {
client_name: "clientName",
scope: "foo openid offline_access",
grant_types: ["client_credentials"],
},
}).then((response) => {
expect(response.body.registration_access_token).to.not.be.empty
})
})

it("should get client when having a valid client_secret in body", function () {
cy.request({
method: "POST",
url: Cypress.env("public_url") + "/oauth2/register",
body: {
client_name: "clientName",
grant_types: ["client_credentials"],
access_token_strategy: accessTokenStrategy,
},
}).then((response) => {
cy.request({
method: "GET",
url:
Cypress.env("public_url") +
"/oauth2/register/" +
response.body.client_id,
headers: {
Authorization:
"Bearer " + response.body.registration_access_token,
},
}).then((response) => {
expect(response.body.client_name).to.equal("clientName")
})
})
it("should get client when having a valid client_secret in body", function () {
cy.request({
method: "POST",
url: Cypress.env("public_url") + "/oauth2/register",
body: {
client_name: "clientName",
grant_types: ["client_credentials"],
},
}).then((response) => {
cy.request({
method: "GET",
url:
Cypress.env("public_url") +
"/oauth2/register/" +
response.body.client_id,
headers: {
Authorization: "Bearer " + response.body.registration_access_token,
},
}).then((response) => {
expect(response.body.client_name).to.equal("clientName")
})
})
})
Expand Down

0 comments on commit 0b24070

Please sign in to comment.