Search code examples
iframebasic-authenticationxwiki

I would like to use Basic Authentication in IFRAME tag in xwiki


for example:

< frame class=“myclass” src=“http://superadmin:admin@myserver/xwiki/bin/view/Main/WebHome?basicauth=1”>

but doesn’t load content of iframe, is it possible ? or not? if this not possible how can i make auto login in xwikiiframe?

i’m already use ldap authentication and this is jsf project.


Solution

  • Well, it works, but you're probably hitting an issue related to not respecting the Same Origin Policy: https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy

    Basically, the myserver part of the iframe's src attribute is different from the current host you are loading the HTML from. Either that or it uses a different protocol (i.e. https vs http).

    Check the browser console for more information where you should find the exact reason why the browser refused to load your iframe.

    Edit: Also note that basic auth URLs have been deprecated for a while now and you should try to avoid them completely, as browsers have started deprecating or dropping this feature completely (most notably, Chrome is among the most aggressive). See https://medium.com/@lmakarov/say-goodbye-to-urls-with-embedded-credentials-b051f6c7b6a3 for more details.