Comments (5)
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.
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.
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.
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.
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)
- handleLogoutRequest and config file HOT 10
- Autoloader calls die(), causes problems with Rector HOT 1
- PHP 8 redirect issue HOT 4
- Notice PHP : Variable is undefined
- phpunit tests broken in github actions HOT 2
- phpCAS::getAttributes gives me an empty array HOT 7
- No ability to disable displaying errors directly into the response. HOT 2
- Differentiate ErrorException from GracefullTerminationException HOT 1
- deprecation warning in php 8.1.2 HOT 2
- time for new release? HOT 3
- Is there a way to use phpCAS within a Symfony API REST? HOT 1
- Endless Loop, ticket not found HOT 5
- Autoload.php should not emit a composer-preferred warning HOT 3
- Version 1.6.0 is a breaking upgrade and is not compatible with older versions HOT 7
- jasig/phpcas package should be abandoned in favor of apereo/phpcas HOT 9
- login with 1.6.0 wrong redirection HOT 2
- Non-empty $_SESSION array disrupts page caching techniques
- DOMDocument::loadXML(): Argument #1 ($source) must not be empty HOT 2
- phpCAS relies on curl being available HOT 1
- Alternate URL for logout requests HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from phpcas.