Align with backchannel logout OIDC spec#1432
Conversation
da506df to
149ded7
Compare
|
@julien-nc not entirely sure about the change for the error logging. |
0478e3e to
05b982d
Compare
|
Added some more alignment with the spec (exp + 1 iss validation step). Was wondering if we should verify that |
julien-nc
left a comment
There was a problem hiding this comment.
Hey. #1431 is merged. Sorry there seems to be a small conflict with your branch. You can rebase on main or just merge main in your branch to resolve the conflict.
Was wondering if we should verify that jti and iat claims are there as well...
Yeah sure, let's keep it simple: It's enough to check if those token attributes are defined.
| ['iss_should_be_set' => true] | ||
| true | ||
| ); | ||
| } elseif ($iss !== $discovery['issuer']) { |
There was a problem hiding this comment.
$iss is not defined at this point.
| $this->logger->error('Backchannel logout error. ' . $error . ' ; ' . $description . | ||
| '. This is likely an IdP issue.'); |
There was a problem hiding this comment.
| $this->logger->error('Backchannel logout error. ' . $error . ' ; ' . $description . | |
| '. This is likely an IdP issue.'); | |
| $this->logger->error('Backchannel logout error. ' . $error . ' ; ' . $description . | |
| '. This is likely an IdP issue.', ['metadata' => $metadata]); |
You could keep the metadata param (which can be renamed) and include it in the logs so the information is more precise than the $isLikelyIdpSide boolean. Wdyt?
| ['multiple_sessions_found' => $sid] | ||
| ); | ||
| $this->logger->warning('[BackchannelLogout] Multiple OIDC sessions retrieved (sid+sub+iss). ' . | ||
| 'This should not happen. Please check that you have created your DB indexes') |
Working on May the 1st are you :p ? |
Checking your github notifications on May 1st? 😁 Yeah for a weird reason I'm working today. I can tell you on a private channel if you're curious.
Nice! Thank you for the enthusiasm. No rush though, feel free to take the public holiday 😉 |
f0865f4 to
f209fb6
Compare
f209fb6 to
d9bf10b
Compare
|
@julien-nc should be ready. |
|
Note : this means that LemonLDAP's users won't be logged out anymore in case of OP initiated logout... |
| string $description, | ||
| array $throttleMetadata = [], | ||
| array $metadata = [], | ||
| string $severity = 'warning', |
There was a problem hiding this comment.
| string $severity = 'warning', | |
| string $severity = \Psr\Log\LogLevel::WARNING, |
| return $this->getBackchannelLogoutErrorResponse( | ||
| 'could not reach provider endpoint', | ||
| 'URL: ' . $provider->getDiscoveryEndpoint() . 'was not reachable', | ||
| severity: 'error', |
There was a problem hiding this comment.
| severity: 'error', | |
| severity: \Psr\Log\LogLevel::ERROR, |
| 'invalid audience', | ||
| 'The audience of the logout token does not match the provider', | ||
| ['invalid_audience' => $logoutTokenPayload->aud] | ||
| ['extra_context' => 'Probably is an IdP side issue', 'aud' => $aud] |
There was a problem hiding this comment.
| ['extra_context' => 'Probably is an IdP side issue', 'aud' => $aud] | |
| ['extra_context' => 'Probably is an IdP side issue', 'aud' => $aud, 'client_id' => $clientId] |
| $iss = $logoutTokenPayload->iss; | ||
| if ($iss !== $discovery['issuer']) { |
There was a problem hiding this comment.
| $iss = $logoutTokenPayload->iss; | |
| if ($iss !== $discovery['issuer']) { | |
| $iss = $logoutTokenPayload->iss; | |
| $discoveryIssuer = $discovery['issuer'] ?? ''; | |
| if ($iss !== $discoveryIssuer) { |
| [ | ||
| 'extra_context' => 'Probably is an IdP side issue', | ||
| 'iss' => $iss, | ||
| 'issuer' => $discovery['issuer'] |
There was a problem hiding this comment.
| 'issuer' => $discovery['issuer'] | |
| 'issuer' => $discoveryIssuer, |
| [ | ||
| 'extra_context' => 'Probably is an IdP side issue', | ||
| 'exp' => $logoutTokenPayload->exp, | ||
| 'current_time' => $this->timeFactory->getTime() |
There was a problem hiding this comment.
| 'current_time' => $this->timeFactory->getTime() | |
| 'current_time' => $this->timeFactory->getTime(), |
| $sub === null ? 'Multiple sessions were found with this (sid,iss)' : 'Multiple sessions were found with this (sid,sub,iss)', | ||
| ['multiple_sessions_found' => $sid] | ||
| $this->logger->warning('[BackchannelLogout] Multiple OIDC sessions retrieved (sid+sub+iss). ' | ||
| . 'This should not happen. Please check that you have created your DB indexes' |
There was a problem hiding this comment.
| . 'This should not happen. Please check that you have created your DB indexes' | |
| . 'This should not happen.' |
Missing indexes don't change anything to this. It cannot make the request return multiple results.
I think it's fine to let this pass if the token expiration is not defined. So:
Sounds good to you? |
refurbished $throttleMetadata not used since 9b5d6c6 Signed-off-by: Spitap <dev@asdrip.fr>
Signed-off-by: Spitap <dev@asdrip.fr>
Signed-off-by: Spitap <dev@asdrip.fr>
Signed-off-by: Spitap <dev@asdrip.fr>
Signed-off-by: Spitap <dev@asdrip.fr>
If you say so. Although it is a clear deviation from the spec I think since it is REQUIRED, and we ought to verify it as we would do in the code function... For instance, had LemonLDAP not forget to make the exp claim required in its RP implementation, the OP would get the 400 error pretty much as current fix. So do I make it optional ? |
d9bf10b to
5576b98
Compare
deliberately removed. See nextcloud#1432 Signed-off-by: Spitap <dev@asdrip.fr>
julien-nc
left a comment
There was a problem hiding this comment.
Let's get this in while it implements the RFC. We can discuss the missing exp later.
|
Thanks a lot for the adjustments. |
Current behaviour
The response of BackChannel logout seems to be missing the Cache-Control header (spec).
The BC logout validation is also missing exp token validation (not expired) and iss validation (equals to issuer in discovery endpoint) per Backchannel logout token validation spec and ID Token validation spec
Changes
getBackchannelLogoutErrorResponse($throttleMetadata)