-
Notifications
You must be signed in to change notification settings - Fork 14
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
fix: qr code value #304
fix: qr code value #304
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -205,20 +205,18 @@ def pre_request_endpoint(self, context: Context, internal_request, **kwargs) -> | |||||||||||||||||
'client_id': self.client_id, | ||||||||||||||||||
'request_uri': f"{self.absolute_request_url}?id={state}", | ||||||||||||||||||
} | ||||||||||||||||||
url_params = urlencode(payload, quote_via=quote_plus) | ||||||||||||||||||
|
||||||||||||||||||
respose_url = self._build_authz_request_url(payload) | ||||||||||||||||||
|
||||||||||||||||||
if is_smartphone(context.http_headers.get('HTTP_USER_AGENT')): | ||||||||||||||||||
# Same Device flow | ||||||||||||||||||
res_url = f'{self.config["authorization"]["url_scheme"]}://authorize?{url_params}' | ||||||||||||||||||
return Redirect(res_url) | ||||||||||||||||||
return Redirect(respose_url) | ||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||
|
||||||||||||||||||
# Cross Device flow | ||||||||||||||||||
res_url = f'{self.client_id}?{url_params}' | ||||||||||||||||||
|
||||||||||||||||||
result = self.template.qrcode_page.render( | ||||||||||||||||||
{ | ||||||||||||||||||
"qrcode_color": self.config["qrcode"]["color"], | ||||||||||||||||||
"qrcode_text": res_url, | ||||||||||||||||||
"qrcode_text": respose_url, | ||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||
"qrcode_size": self.config["qrcode"]["size"], | ||||||||||||||||||
"qrcode_logo_path": self.config["qrcode"]["logo_path"], | ||||||||||||||||||
"qrcode_expiration_time": self.config["qrcode"]["expiration_time"], | ||||||||||||||||||
|
@@ -342,6 +340,15 @@ def db_engine(self) -> DBEngine: | |||||||||||||||||
|
||||||||||||||||||
return self._db_engine | ||||||||||||||||||
|
||||||||||||||||||
def _build_authz_request_url(self, payload: dict) -> str: | ||||||||||||||||||
scheme = self.config["authorization"]["url_scheme"] | ||||||||||||||||||
# NOTE: path component is currently unused by the protocol, but currently | ||||||||||||||||||
# we leave it there as 'authorize' to stress the fact that this is an | ||||||||||||||||||
# OAuth 2.0 request modified by JAR (RFC9101) | ||||||||||||||||||
path = "authorize" | ||||||||||||||||||
query_params = urlencode(payload, quote_via=quote_plus) | ||||||||||||||||||
return f"{scheme}://{path}?{query_params}" | ||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
this would work only with custom url schemes, using universal links "://" will be duplicated and wrongly appended I would suggest something like this
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. to support univesal link, further changes were added; this includes
|
||||||||||||||||||
|
||||||||||||||||||
@property | ||||||||||||||||||
def default_metadata_private_jwk(self) -> tuple: | ||||||||||||||||||
"""Returns the default metadata private JWK""" | ||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.