Git Product home page Git Product logo

Comments (5)

adamfranco avatar adamfranco commented on May 28, 2024

Sorry for the delay, I've been on holiday for the past two weeks. I'll try to take a look at this tomorrow. Happy New Year!

from phpcas.

adamfranco avatar adamfranco commented on May 28, 2024

Thanks for finding this issue. Proxy requests that had both a valid session cookie and a proxy ticket were falling through the big isAuthenticated() if/else block and the $res wasn't being set correctly.

from phpcas.

jfritschi avatar jfritschi commented on May 28, 2024

Welcome back Adam.

Just a crazy thought from my side. Why do we even (re)send a ticket if we already have a valid session? I feel that there is a bug underneath:
We either resend an used ticket, we get a new ticket even though it's not necessary or i'm missing something. :D

from phpcas.

adamfranco avatar adamfranco commented on May 28, 2024

I was actually thinking the same thing about resending the tickets, but ran into two issues:

1. Tickets are for one request only:

The following line in the CAS Protocol indicates that proxy tickets are single-use:

3.2.1. proxy ticket properties

   * Proxy tickets MUST only be valid for one ticket validation attempt. Whether or not validation was successful, 
     CAS MUST then invalidate the ticket, causing all future validation attempts of that same ticket to fail.

Because of this, it seems like we shouldn't re-send the first proxy ticket that we obtained for the service since it is guaranteed to be invalid if validation against the CAS server is done.

2. What happens when the service session or CAS session expires?

When a proxy ticket is sent with each service request, the failure mode for service session expiration is to authenticate the new proxy ticket and start a new session. If the CAS session expires, then generating a new proxy ticket will fail in the client's initializeProxiedService(), resulting in a CAS_ProxyTicketException which can be caught by the client application. The client application can then renew authentication and generate a valid proxy ticket before sending the proxied service request again.

If a proxy ticket isn't sent with every request, then when the service session expires the service request will redirect to the CAS login page (similar to the issue that began this thread) since there is no proxy-ticket to validate. A 302 redirect to the CAS login page isn't something that the client can handle as easily a CAS_ProxyTicketException.


If you can think of a solution that would reduce the need to generate extra proxy tickets while still handling session expiration gracefully, I'd be happy to try to implement it.

from phpcas.

jfritschi avatar jfritschi commented on May 28, 2024

I think the solution could be something like interpreting the http status code for any repeat call of an proxied service.
For the first call you always get an PT to access the service. Once you have any(?) cookie for a proxied service you assume it's a valid session cookie of some sort (you can't assume some specific format i guess) and try to access the service without aquiring a new PT. If you recieve any other status than 200 OK you assume you need a new PT and call again with a new PT. I think we are currently doing something similar right now once you have a failure but i haven't had time to check yet.

I think i will have some time on the weekend to dig into this matter.

I haven't really thought it through but i was the first thing that came to my mind.

from phpcas.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.