Fredx87 / cypress-keycloak-commands

Cypress commands for login with Keycloak
MIT License
70 stars 30 forks source link

mock session-iframe instead of changing the frontend for runtime #46

Open rthaenert opened 2 years ago

rthaenert commented 2 years ago

In the docs the problem with the session status iframe is mentioned.

Besides from changing the frontend only for testing it is also possible to just provide a fake response for the iframe:

        cy.intercept(`<yourKeycloakInstance>/login-status-iframe.html`,
            {body: '<html><body><script>window.addEventListener("message", 
             (event) => {event.source.postMessage(\'unchanged\', event.origin);}, false);</script></body></html>'});

(see https://openid.net/specs/openid-connect-session-1_0.html#RPiframe)

I'm currently using this to avoid changing the frontend config only for testing. That could be one possible fix for issues like issue #23.

Happy to provide a PR if this is helpful.

jdtully commented 2 years ago

anyone gonna adopt this and fix it? I'm not that good yet

On Thu, Feb 3, 2022 at 2:47 AM Ralf Thaenert @.***> wrote:

In the docs https://github.com/Fredx87/cypress-keycloak-commands#session-status-iframe the problem with the session status iframe is mentioned.

Besides from changing the frontend only for testing it is also possible to just provide a fake response for the iframe:

    cy.intercept(`<yourKeycloakInstance>/login-status-iframe.html`,
        {body: '<html><body><script>window.addEventListener("message",
         (event) => {event.source.postMessage(\'unchanged\', event.origin);}, false);</script></body></html>'});

(see https://openid.net/specs/openid-connect-session-1_0.html#RPiframe)

I'm currently using this to avoid changing the frontend config only for testing. That could be one possible fix for issues like issue #23 https://github.com/Fredx87/cypress-keycloak-commands/issues/23.

Happy to provide a PR if this is helpful.

— Reply to this email directly, view it on GitHub https://github.com/Fredx87/cypress-keycloak-commands/issues/46, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALVKJ2SN7YU5HMYI6ZSEYHDUZIXITANCNFSM5NOFH73Q . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you are subscribed to this thread.Message ID: @.***>

-- Jeffrey Tully

rthaenert commented 2 years ago

I would be glad to provide a PR but currently there are many open Pull Requests which are not looked at. Let's wait a bit and see whether this project is still maintained or if someone creates a fork and picks it up.