-
-
Notifications
You must be signed in to change notification settings - Fork 959
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# Conflicts: # selfservice/strategy/oidc/strategy.go
- Loading branch information
Showing
57 changed files
with
1,997 additions
and
1,257 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import {APP_URL, gen, website} from "../../../../helpers"; | ||
|
||
context('Login', () => { | ||
beforeEach(() => { | ||
cy.clearCookies() | ||
cy.visit(APP_URL + '/auth/login') | ||
}) | ||
|
||
it('should fail when the login request is rejected', () => { | ||
const email = gen.email() | ||
cy.get('button[value="hydra"]').click() | ||
cy.get('#reject').click() | ||
cy.location('pathname').should('equal','/auth/login') | ||
cy.get('.form-errors .message').should('contain.text', 'login rejected request') | ||
cy.noSession() | ||
}) | ||
|
||
it('should fail when the consent request is rejected', () => { | ||
const email = gen.email() | ||
cy.get('button[value="hydra"]').click() | ||
cy.get('#username').type(email) | ||
cy.get('#accept').click() | ||
cy.get('#reject').click() | ||
cy.location('pathname').should('equal','/auth/login') | ||
cy.get('.form-errors .message').should('contain.text', 'consent rejected request') | ||
cy.noSession() | ||
}) | ||
|
||
it('should fail when the id_token is missing', () => { | ||
const email = gen.email() | ||
cy.get('button[value="hydra"]').click() | ||
cy.get('#username').type(email) | ||
cy.get('#accept').click() | ||
cy.get('#website').type(website) | ||
cy.get('#accept').click() | ||
cy.location('pathname').should('equal','/auth/login') | ||
cy.get('.form-errors .message').should('contain.text', 'no id_token') | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { APP_URL, gen, website } from '../../../../helpers' | ||
|
||
context('Login', () => { | ||
beforeEach(() => { | ||
cy.clearCookies() | ||
}) | ||
|
||
it('should be able to sign up, sign out, and then sign in', () => { | ||
const email = gen.email() | ||
|
||
cy.registerOidc({email, website}) | ||
cy.get('a[href*="logout"]').click() | ||
cy.noSession() | ||
cy.loginOidc({email}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { APP_URL, gen, password, website } from '../../../../helpers' | ||
|
||
context('Login', () => { | ||
const email = gen.email() | ||
|
||
before(() => { | ||
cy.registerOidc({email, website}) | ||
}) | ||
|
||
beforeEach(() => { | ||
cy.visit(APP_URL + '/') | ||
}) | ||
|
||
it('should sign out and be able to sign in again', () => { | ||
cy.get('a[href*="logout"]').click() | ||
cy.noSession() | ||
cy.url().should('include', '/auth/login') | ||
}) | ||
}) |
39 changes: 39 additions & 0 deletions
39
cypress/integration/profiles/oidc/registration/error.spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import {APP_URL, gen, website} from "../../../../helpers"; | ||
|
||
context('Register', () => { | ||
beforeEach(() => { | ||
cy.clearCookies() | ||
cy.visit(APP_URL + '/auth/registration') | ||
}) | ||
|
||
it('should fail when the login request is rejected', () => { | ||
const email = gen.email() | ||
cy.get('button[value="hydra"]').click() | ||
cy.get('#reject').click() | ||
cy.location('pathname').should('equal','/auth/registration') | ||
cy.get('.form-errors .message').should('contain.text', 'login rejected request') | ||
cy.noSession() | ||
}) | ||
|
||
it('should fail when the consent request is rejected', () => { | ||
const email = gen.email() | ||
cy.get('button[value="hydra"]').click() | ||
cy.get('#username').type(email) | ||
cy.get('#accept').click() | ||
cy.get('#reject').click() | ||
cy.location('pathname').should('equal','/auth/registration') | ||
cy.get('.form-errors .message').should('contain.text', 'consent rejected request') | ||
cy.noSession() | ||
}) | ||
|
||
it('should fail when the id_token is missing', () => { | ||
const email = gen.email() | ||
cy.get('button[value="hydra"]').click() | ||
cy.get('#username').type(email) | ||
cy.get('#accept').click() | ||
cy.get('#website').type(website) | ||
cy.get('#accept').click() | ||
cy.location('pathname').should('equal','/auth/registration') | ||
cy.get('.form-errors .message').should('contain.text', 'no id_token') | ||
}) | ||
}) |
83 changes: 83 additions & 0 deletions
83
cypress/integration/profiles/oidc/registration/success.spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
import {APP_URL, gen, website} from '../../../../helpers' | ||
|
||
context('Register', () => { | ||
beforeEach(() => { | ||
cy.clearCookies() | ||
cy.visit(APP_URL + '/auth/registration') | ||
}) | ||
|
||
const shouldSession = (email) => (session) => { | ||
const {identity} = session | ||
expect(identity.id).to.not.be.empty | ||
expect(identity.traits_schema_id).to.equal('default') | ||
expect(identity.traits_schema_url).to.equal( | ||
`${APP_URL}/.ory/kratos/public/schemas/default` | ||
) | ||
expect(identity.traits.website).to.equal(website) | ||
expect(identity.traits.email).to.equal(email) | ||
} | ||
|
||
it('should be able to sign up with incomplete data and finally be signed in', () => { | ||
const email = gen.email() | ||
|
||
cy.registerOidc({email, expectSession: false}) | ||
|
||
cy.get('#registration-password').should('not.exist'); | ||
cy.get('#registration-oidc input[name="traits.email"]').should('have.value', email) | ||
cy.get('#registration-oidc form > *:last-child').should('have.attr', 'name', 'provider') | ||
cy.get('.form-errors .message').should('contain.text', 'missing properties: "website"') | ||
cy.get('#registration-oidc input[name="traits.website"]').type("http://s") | ||
|
||
cy.get('button[value="hydra"]').click() | ||
|
||
cy.get('#registration-password').should('not.exist'); | ||
cy.get('#registration-oidc input[name="traits.email"]').should('have.value', email) | ||
cy.get('#registration-oidc form > *:last-child').should('have.attr', 'name', 'provider') | ||
cy.get('.form-errors .message').should('contain.text', 'length must be >= 10') | ||
cy.get('#registration-oidc input[name="traits.website"]').should('have.value', 'http://s').clear().type(website) | ||
|
||
cy.get('button[value="hydra"]').click() | ||
|
||
cy.session().should(shouldSession(email)) | ||
}) | ||
|
||
it('should be able to sign up with complete data', () => { | ||
const email = gen.email() | ||
|
||
cy.registerOidc({email, website}) | ||
cy.session().should(shouldSession(email)) | ||
}) | ||
it('should be able to convert a sign up flow to a sign in flow', () => { | ||
const email = gen.email() | ||
|
||
cy.registerOidc({email, website}) | ||
cy.get('a[href*="logout"]').click() | ||
cy.noSession() | ||
cy.visit(APP_URL + '/auth/registration') | ||
cy.get('button[value="hydra"]').click() | ||
|
||
cy.session().should(shouldSession(email)) | ||
}) | ||
|
||
it('should be able to convert a sign in flow to a sign up flow', () => { | ||
const email = gen.email() | ||
cy.visit(APP_URL + '/auth/login') | ||
cy.get('button[value="hydra"]').click() | ||
cy.get('#username').clear().type(email) | ||
cy.get('#remember').click() | ||
cy.get('#accept').click() | ||
cy.get('input[name="scope"]').each($el => cy.wrap($el).click()) | ||
cy.get('#remember').click() | ||
cy.get('#accept').click() | ||
|
||
cy.get('.form-errors .message').should('contain.text', 'missing properties: "website"') | ||
cy.get('#registration-oidc input[name="traits.website"]').type("http://s") | ||
cy.get('button[value="hydra"]').click() | ||
|
||
cy.get('.form-errors .message').should('contain.text', 'length must be >= 10') | ||
cy.get('#registration-oidc input[name="traits.website"]').should('have.value', 'http://s').clear().type(website) | ||
cy.get('button[value="hydra"]').click() | ||
|
||
cy.session().should(shouldSession(email)) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.