-
-
Notifications
You must be signed in to change notification settings - Fork 489
suggestion add is_confidential
to oauth2 base.Client
#597
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
If we do this, would this void or simplify #593 to a large extend? If so, then it might be the better direction in the first place? |
It won't void #593, but I think it would simplify future maintenance and integration with requests_oauthlib. It looks like several sections of the two libraries are subclassing functions or altering the behavior based on detecting the class type (e.g. WebApplicationClient vs MobileApplicationClient) where the behavior is actually dependent on whether the client is "confidential" or "public". More importantly, a client being "confidential" or not is an attribute/descriptor of clients in the oAuth2 spec - but it's not explicitly part of the oauthlib clients. |
To me, a "confidential" client is a client with a secret. So, if we add If we agree on this, we could change #593 to take this into account and it will simplify the implementations. Does anyone see disadvantages of doing this ? |
To the RFC, confidential is the scope of security https://tools.ietf.org/html/rfc6749#section-2.1 Both "public" and "confidential" clients have a client_secret on the "device". The difference is who controls the device. For example, a backend web application is "confidential", but a frontend web application or mobile application is "public".
|
I did a deepdive into the code. After consideration, it seems like this request (#597) would simply be a method of documenting the type of client at this time. It certainly can wait until after 585/593, which (IMHO) should be handled sooner than later. While the various subclasses of |
I think it's still actionable. looking at the current master, and oauth2 only, the is_confidential attribute -- based on public/confidential distinction in the rfc - would be the following base.py Client backend_application.py BackendApplicationClient legacy_application LegacyApplicationClient mobile_application.py MobileApplicationClient service_appication.py ServiceApplicationClient web_application.py WebApplicationClient |
BackendApplicationClient is always confidential. About the others, they are sometime confidential, sometime public. Thoughts? Legacy aka ROPC:
Web aka AuthorizationCode:
Service aka Assertion:
|
I based my list off of the current implementations which use the RFC concept of confidential. The docstrings for most (all?) of these say public or confidential and refer to the rfc’s meaning of the term; for example, WebApplicationClient states it is confidential in the class docstring.
… On Aug 26, 2019, at 6:25 AM, Jonathan Huot ***@***.***> wrote:
BackendApplicationClient is always confidential.
MobileApplicationClient is always public.
About the others, they are sometime confidential, sometime public.
I think we can rely on the existence of the client_secret to define if they are confidential or public.
However, it means that's not a class method but an instance method.
Thoughts?
Legacy aka ROPC:
https://tools.ietf.org/html/rfc6749#section-4.3.2
If the client type is confidential or the client was issued client
credentials (or assigned other authentication requirements), the
client MUST authenticate with the authorization server as described
in Section 3.2.1.
Web aka AuthorizationCode:
https://tools.ietf.org/html/rfc6749#section-2.1
public
Clients incapable of maintaining the confidentiality of their
credentials (e.g., clients executing on the device used by the
resource owner, such as an installed native application or a web
browser-based application), and incapable of secure client
authentication via any other means.
Service aka Assertion:
https://tools.ietf.org/html/rfc7521#section-4.1
Authentication of the client is optional, as described in
Section 3.2.1 of OAuth 2.0 [RFC6749], and consequently, the
"client_id" is only needed when a form of client authentication that
relies on the parameter is used.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
I agree this is how it should be in practice, but technically it is still possible to have a public client using a
If we do what you suggest, the class would be marked as |
I discovered this as part of #585, but it's a separate (though related) issue...
The base
Client
object does not track if a client is confidential (or not), however clients must act differently in certain situations depending on this. It looks like this was largely handled by creating a different base class for each 'concept'. I think adding anis_confidential' property to the base
Client` class (and set in the subclasses) would allow for more code re-use and just be generally more descriptive and self-documenting.The text was updated successfully, but these errors were encountered: