Quantcast

CAS login in an Iframe in a different server

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

CAS login in an Iframe in a different server

Álvaro Manso Gutiérrez
Hello,

I have the following situation: I need to integrate the login view of CAS in a portal. The CAS is used for access to an application that is an server (server A) with its CAS-client. The portal are in a different server (server B)

I can show the login view in an iframe in the portal, but what I want is:
If the login is successfull, I have a valid ticket, redirect the iframe to the main window (i.e using javascript)
If the login is not successfull, show the error in the portal( in the practice do nothing).

The problem is that my applications are in different servers, so I can't access to the session variables of the serverB in the serverA. I don't know how to obtain the ticket of the login in the portal to decide if I have to redirect or not.

Are there any way to do that?

_______________________________________________
Yale CAS mailing list
[hidden email]
http://tp.its.yale.edu/mailman/listinfo/cas
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: CAS login in an Iframe in a different server

Scott Battaglia-2
All you need to do is modify the last action in the login-flow.xml.

Currently its hardcoded to an end-state that issues a 302 redirect.  You'll need to change the end-state so that it goes to a JSP page (within the CAS server).  That JSP page will include JavaScript which will redirect the entire window (I forgot which JavaScript object exactly) to the service URL with the service ticket appended.

-Scott

On Thu, Feb 28, 2008 at 6:43 AM, Álvaro Manso Gutiérrez <[hidden email]> wrote:
Hello,

I have the following situation: I need to integrate the login view of CAS in a portal. The CAS is used for access to an application that is an server (server A) with its CAS-client. The portal are in a different server (server B)

I can show the login view in an iframe in the portal, but what I want is:
If the login is successfull, I have a valid ticket, redirect the iframe to the main window (i.e using javascript)
If the login is not successfull, show the error in the portal( in the practice do nothing).

The problem is that my applications are in different servers, so I can't access to the session variables of the serverB in the serverA. I don't know how to obtain the ticket of the login in the portal to decide if I have to redirect or not.

Are there any way to do that?

_______________________________________________
Yale CAS mailing list
[hidden email]
http://tp.its.yale.edu/mailman/listinfo/cas




--
-Scott Battaglia
PGP Public Key Id: 0x383733AA
LinkedIn: http://www.linkedin.com/in/scottbattaglia
_______________________________________________
Yale CAS mailing list
[hidden email]
http://tp.its.yale.edu/mailman/listinfo/cas
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: CAS login in an Iframe in a different server

Álvaro Manso Gutiérrez
This is what I've done:

I've customized the class org.jasig.cas.web.flow.DynamicRedirectViewSelector, instead of
return new ExternalRedirect(service.getResponse(ticket).getUrl());
I'm doing:
final Map<String, Object> modelAux = new HashMap<String, Object>();
modelAux.put("service", service.getResponse(ticket).getUrl());
return new ApplicationView("redirectView", modelAux);

redirectView is defined in protocol_views.properties and the jsp is the following:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">

<script type="text/javascript">
function redirect(){
    window.top.location.href = document.redirect.service.value;
}

</script>
</head>
<body onload="redirect()">
    <form name="redirect" action="">
        <input type="hidden" name="service" id="service" value="${service}" />
    </form>
</body>
</html>

This is 'almost' working, but I have a new problem:
My service contains another iframe with another application that is also casified.
When I pass the login the navigator is redirected to the first application, and after the load of the first application the navigator is redirected to the second application because the login-flow is executed twice.
The expected result should be that the second application be loaded in an iframe in the first application.
Is there any way to detect  how many times is it being exectued the login flow? Maybe passing parameters in the request or something like that?




2008/2/28, Scott Battaglia <[hidden email]>:
All you need to do is modify the last action in the login-flow.xml.

Currently its hardcoded to an end-state that issues a 302 redirect.  You'll need to change the end-state so that it goes to a JSP page (within the CAS server).  That JSP page will include JavaScript which will redirect the entire window (I forgot which JavaScript object exactly) to the service URL with the service ticket appended.

-Scott

On Thu, Feb 28, 2008 at 6:43 AM, Álvaro Manso Gutiérrez <[hidden email]> wrote:
Hello,

I have the following situation: I need to integrate the login view of CAS in a portal. The CAS is used for access to an application that is an server (server A) with its CAS-client. The portal are in a different server (server B)

I can show the login view in an iframe in the portal, but what I want is:
If the login is successfull, I have a valid ticket, redirect the iframe to the main window (i.e using javascript)
If the login is not successfull, show the error in the portal( in the practice do nothing).

The problem is that my applications are in different servers, so I can't access to the session variables of the serverB in the serverA. I don't know how to obtain the ticket of the login in the portal to decide if I have to redirect or not.

Are there any way to do that?

_______________________________________________
Yale CAS mailing list
[hidden email]
<a href="http://tp.its.yale.edu/mailman/listinfo/cas" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://tp.its.yale.edu/mailman/listinfo/cas




--
-Scott Battaglia
PGP Public Key Id: 0x383733AA
LinkedIn: <a href="http://www.linkedin.com/in/scottbattaglia" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://www.linkedin.com/in/scottbattaglia
_______________________________________________
Yale CAS mailing list
[hidden email]
<a onclick="return top.js.OpenExtLink(window,event,this)" href="http://tp.its.yale.edu/mailman/listinfo/cas" target="_blank">http://tp.its.yale.edu/mailman/listinfo/cas



_______________________________________________
Yale CAS mailing list
[hidden email]
http://tp.its.yale.edu/mailman/listinfo/cas
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: CAS login in an Iframe in a different server

Álvaro Manso Gutiérrez
I having several problems with my "customization" because some of my casified applications must be loaded in iframes, but with the changes they are being loaded outside.
According to my CAS configuration I do only one login, after the successfull login I have access to all my applications, and I don't need to login again.

What I would need is to execute my redirection only when I am doing the login, I mean just after casLoginview, and never ever.
Is there any way to detect that?, is that information in the context?

2008/3/3, Álvaro Manso Gutiérrez <[hidden email]>:
This is what I've done:

I've customized the class org.jasig.cas.web.flow.DynamicRedirectViewSelector, instead of
return new ExternalRedirect(service.getResponse(ticket).getUrl());
I'm doing:
final Map<String, Object> modelAux = new HashMap<String, Object>();
modelAux.put("service", service.getResponse(ticket).getUrl());
return new ApplicationView("redirectView", modelAux);

redirectView is defined in protocol_views.properties and the jsp is the following:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">

<script type="text/javascript">
function redirect(){
    window.top.location.href = document.redirect.service.value;
}

</script>
</head>
<body onload="redirect()">
    <form name="redirect" action="">
        <input type="hidden" name="service" id="service" value="${service}" />
    </form>
</body>
</html>

This is 'almost' working, but I have a new problem:
My service contains another iframe with another application that is also casified.
When I pass the login the navigator is redirected to the first application, and after the load of the first application the navigator is redirected to the second application because the login-flow is executed twice.
The expected result should be that the second application be loaded in an iframe in the first application.
Is there any way to detect  how many times is it being exectued the login flow? Maybe passing parameters in the request or something like that?




2008/2/28, Scott Battaglia <[hidden email]>:
All you need to do is modify the last action in the login-flow.xml.

Currently its hardcoded to an end-state that issues a 302 redirect.  You'll need to change the end-state so that it goes to a JSP page (within the CAS server).  That JSP page will include JavaScript which will redirect the entire window (I forgot which JavaScript object exactly) to the service URL with the service ticket appended.

-Scott

On Thu, Feb 28, 2008 at 6:43 AM, Álvaro Manso Gutiérrez <[hidden email]> wrote:
Hello,

I have the following situation: I need to integrate the login view of CAS in a portal. The CAS is used for access to an application that is an server (server A) with its CAS-client. The portal are in a different server (server B)

I can show the login view in an iframe in the portal, but what I want is:
If the login is successfull, I have a valid ticket, redirect the iframe to the main window (i.e using javascript)
If the login is not successfull, show the error in the portal( in the practice do nothing).

The problem is that my applications are in different servers, so I can't access to the session variables of the serverB in the serverA. I don't know how to obtain the ticket of the login in the portal to decide if I have to redirect or not.

Are there any way to do that?

_______________________________________________
Yale CAS mailing list
[hidden email]
<a href="http://tp.its.yale.edu/mailman/listinfo/cas" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://tp.its.yale.edu/mailman/listinfo/cas




--
-Scott Battaglia
PGP Public Key Id: 0x383733AA
LinkedIn: <a href="http://www.linkedin.com/in/scottbattaglia" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://www.linkedin.com/in/scottbattaglia
_______________________________________________
Yale CAS mailing list
[hidden email]
<a href="http://tp.its.yale.edu/mailman/listinfo/cas" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://tp.its.yale.edu/mailman/listinfo/cas




_______________________________________________
Yale CAS mailing list
[hidden email]
http://tp.its.yale.edu/mailman/listinfo/cas
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: CAS login in an Iframe in a different server

Scott Battaglia-2
If you have multiple iframes on the same page, when you redirect to CAS you need some form of request parameter to tell your JavaScript wether it should just do a location.href or replace the entire window.
-Scott

On Mon, Mar 3, 2008 at 12:07 PM, Álvaro Manso Gutiérrez <[hidden email]> wrote:
I having several problems with my "customization" because some of my casified applications must be loaded in iframes, but with the changes they are being loaded outside.
According to my CAS configuration I do only one login, after the successfull login I have access to all my applications, and I don't need to login again.

What I would need is to execute my redirection only when I am doing the login, I mean just after casLoginview, and never ever.
Is there any way to detect that?, is that information in the context?

2008/3/3, Álvaro Manso Gutiérrez <[hidden email]>:
This is what I've done:

I've customized the class org.jasig.cas.web.flow.DynamicRedirectViewSelector, instead of
return new ExternalRedirect(service.getResponse(ticket).getUrl());
I'm doing:
final Map<String, Object> modelAux = new HashMap<String, Object>();
modelAux.put("service", service.getResponse(ticket).getUrl());
return new ApplicationView("redirectView", modelAux);

redirectView is defined in protocol_views.properties and the jsp is the following:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">

<script type="text/javascript">
function redirect(){
    window.top.location.href = document.redirect.service.value;
}

</script>
</head>
<body onload="redirect()">
    <form name="redirect" action="">
        <input type="hidden" name="service" id="service" value="${service}" />
    </form>
</body>
</html>

This is 'almost' working, but I have a new problem:
My service contains another iframe with another application that is also casified.
When I pass the login the navigator is redirected to the first application, and after the load of the first application the navigator is redirected to the second application because the login-flow is executed twice.
The expected result should be that the second application be loaded in an iframe in the first application.
Is there any way to detect  how many times is it being exectued the login flow? Maybe passing parameters in the request or something like that?




2008/2/28, Scott Battaglia <[hidden email]>:
All you need to do is modify the last action in the login-flow.xml.

Currently its hardcoded to an end-state that issues a 302 redirect.  You'll need to change the end-state so that it goes to a JSP page (within the CAS server).  That JSP page will include JavaScript which will redirect the entire window (I forgot which JavaScript object exactly) to the service URL with the service ticket appended.

-Scott

On Thu, Feb 28, 2008 at 6:43 AM, Álvaro Manso Gutiérrez <[hidden email]> wrote:
Hello,

I have the following situation: I need to integrate the login view of CAS in a portal. The CAS is used for access to an application that is an server (server A) with its CAS-client. The portal are in a different server (server B)

I can show the login view in an iframe in the portal, but what I want is:
If the login is successfull, I have a valid ticket, redirect the iframe to the main window (i.e using javascript)
If the login is not successfull, show the error in the portal( in the practice do nothing).

The problem is that my applications are in different servers, so I can't access to the session variables of the serverB in the serverA. I don't know how to obtain the ticket of the login in the portal to decide if I have to redirect or not.

Are there any way to do that?

_______________________________________________
Yale CAS mailing list
[hidden email]
http://tp.its.yale.edu/mailman/listinfo/cas




--
-Scott Battaglia
PGP Public Key Id: 0x383733AA
LinkedIn: http://www.linkedin.com/in/scottbattaglia
_______________________________________________
Yale CAS mailing list
[hidden email]
http://tp.its.yale.edu/mailman/listinfo/cas




_______________________________________________
Yale CAS mailing list
[hidden email]
http://tp.its.yale.edu/mailman/listinfo/cas




--
-Scott Battaglia
PGP Public Key Id: 0x383733AA
LinkedIn: http://www.linkedin.com/in/scottbattaglia
_______________________________________________
Yale CAS mailing list
[hidden email]
http://tp.its.yale.edu/mailman/listinfo/cas
Loading...