Skip to content
This repository was archived by the owner on Jun 12, 2021. It is now read-only.

Conversation

@nsklikas
Copy link
Contributor

@rohe mentioned that the new session management system is ready and that we should start discussing whether it should be merged and if any changes are needed.

So I am taking the liberty to create this PR to discuss any changes we see necessary.

rohe added 30 commits October 22, 2020 09:10
There might not be any client information at this time. This is an effect of automatic client registration as defined in the OIDC federation specification.
Removed duplicated code in oauth2/oidc Authorization classes.
A token must have a value.
sub=user,
sid=sid,
sid=session_id,
state=request["state"],
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

request.get("state")

state is optional

Copy link
Member

@peppelinux peppelinux Mar 10, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

state is recommendend in oidc ...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But not required. Hence if it's there in the request we add it to the cookie info otherwise it will just be ignored.

Comment on lines 127 to 141
authn_endpoint = endpoint.get("authorization")
if authn_endpoint is None:
LOGGER.warning(
"No authorization endpoint found, skipping PKCE configuration"
)
return

token_endpoint = endpoint.get("token")
if token_endpoint is None:
LOGGER.warning(
"No token endpoint found, skipping PKCE configuration"
)
return

authn_endpoint.post_parse_request.append(post_authn_parse)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this removed?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably a better path for this module would be src/oidcendpoint/oauth2/add_on/pkce.py as it belongs to OAuth2 and can be used even in oidc

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right!

if authn_time:
args["authn_time"] = authn_time
else:
_ts = kwargs.get("timestamp")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what would be a default value on _ts?

_conf = self.conf.get("userinfo")
if _conf:
if self.sdb:
if self.session_manager:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes "session_manager" is more readable than sdb! 👌

code)
_response["refresh_token"] = refresh_token.value

code.register_usage()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mentioning @rohe because this conversation has been lost after some pushes.

grant_type_options in (None, True)
and grant_type in HELPER_BY_GRANT_TYPE
):
self.helper[grant_type] = HELPER_BY_GRANT_TYPE[grant_type]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The class will need to be initialized ->
self.helper[grant_type] = HELPER_BY_GRANT_TYPE[grant_type](self)

},
},
{
"authorization_code": True, # Both True and None end up using the defaults
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These tests were removed and would catch the bug I reviewd above relating to the initialization of the helper endpoint classes.

return user_info
else:
if client_id not in user_info['subordinate']:
raise ValueError('No session from that client for that user')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

raise NoSuchGrant (or even NoSuchClientSession)

:return:
"""
if isinstance(request, AuthorizationErrorResponse):
return request
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is probably not strictly related to this PR but could be fixed here anyway. A check should be added here for the grant type because we don't want to check for code in a refresh token grant or a token exchange one.

Or we could check for the request instance like this (maybe strictly checking for the grant type to be authorization_code is cleaner tho):

if isinstance(
    request,
    (AuthorizationErrorResponse, RefreshAccessTokenRequest, TokenExchangeRequest),
):

@nsklikas
Copy link
Contributor Author

This PR has been open for long enough. We should close it but there are still some open issues

If @rohe is ok with it I can push the fixes required and you can review them so that we can finally close this PR.

@rohe
Copy link
Contributor

rohe commented Mar 29, 2021

Let's !!

I've been side tracked by the persistent storage handling.
Have done the RP side. almost done with the OP side when I hit a snag earlier today :-(

@nsklikas nsklikas mentioned this pull request Mar 31, 2021
We already have the grant in most cases so we can fetch the token from
inside it instead of querying the DB again.
WIP: Make more fixes to the new_session_handling before it gets merged
@rohe rohe merged commit 25466cc into develop Apr 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants