Skip to content
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

Generating wildcard ACL and URL tokens for Akamai #265

Merged
merged 8 commits into from
Nov 13, 2023

Conversation

evgkirov
Copy link
Collaborator

@evgkirov evgkirov commented Oct 26, 2023

Related issues: #263 and #264.

This pull request introduces the ability to generate secure URLs with the same signature valid not only for the base URL of the file (e.g., https://cdn.yourdomain.com/52da3bfc-7cd8-4861-8b05-126fef7a6994/) but also for all of its transformations (#264). This is optional by default.

Also, AkamaiSecureUrlBuilderWithUrlToken class has been implemented (#263).

A new method called generate_secure_url_token is exposed for Uploadcare. Instead of full URL it will return just the token (unlike the generate_secure_url method).

Added

  • For Uploadcare:

    • added generate_secure_url_token method.
    • added optional wildcard parameter to generate_secure_url method.
  • For AkamaiSecureUrlBuilderWithAclToken:

    • added get_token method.
    • added optional wildcard parameter to build method.
  • AkamaiSecureUrlBuilderWithUrlToken class.

Changed

  • AkamaiSecureUrlBuilder has been renamed to AkamaiSecureUrlBuilderWithAclToken. It is still available under the old name and works as before, but it will give you a deprecation warning when you use it.

@evgkirov evgkirov marked this pull request as draft October 26, 2023 21:04
Copy link
Member

@dmitry-mukhin dmitry-mukhin left a comment

Choose a reason for hiding this comment

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

I think that AkamaiBuilder should have a method to get only token, now it's inside _build_token.

Intended usage, probably is something like:

original_url = "https://acme.ucarecdn.com/:uuid/"
builder = AkamaiSecureUrlBuilder(original_url, secret)
token = builder.get_token()

secure_preview = f"{original_url}-/preview/100x100/?token={token}"

@evgkirov evgkirov marked this pull request as ready for review October 26, 2023 23:29
@evgkirov evgkirov marked this pull request as draft October 26, 2023 23:51
@evgkirov evgkirov changed the title Wildcard ACL for generate_secure_url Generating wildcard ACL and URL tokens for Akamai Oct 27, 2023
@evgkirov evgkirov marked this pull request as ready for review October 27, 2023 01:41
HISTORY.md Outdated Show resolved Hide resolved
docs/core_api.rst Outdated Show resolved Hide resolved
docs/core_api.rst Outdated Show resolved Hide resolved
docs/core_api.rst Outdated Show resolved Hide resolved
docs/core_api.rst Outdated Show resolved Hide resolved
evgkirov and others added 4 commits November 10, 2023 19:39
Co-authored-by: Dmitry Mukhin <dm@uploadcare.com>
Co-authored-by: Dmitry Mukhin <dm@uploadcare.com>
Co-authored-by: Dmitry Mukhin <dm@uploadcare.com>
Co-authored-by: Dmitry Mukhin <dm@uploadcare.com>
@evgkirov evgkirov merged commit c897f7d into main Nov 13, 2023
1 check passed
@evgkirov evgkirov deleted the feature/264-uuid_signing branch November 13, 2023 19:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants