Giter Site home page Giter Site logo

signed-url's People

Contributors

tobytwigger avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

signed-url's Issues

HTTPS not working

Summary of the bug
if the URL stored in https it cannot be used and become 404. but if you stored in http, it working.

To Reproduce
store the URL in https:// and you will try to open the pages with the middleware you will get 404.

Suggestion of a fix
maybe can make it check both HTTP and HTTPS.

Change link request binding to Link::class

What will the feature achieve?
Free up the 'link' key in the request.

Why is this necessary?
The link model is made available through $request->get('link');, but this may be needed by a user since it is a common word.

How should the feature work?
The link model should instead be bound to the class name, e.g. \Linkeys\UrlSigner\Models\Link::class. This is much less likely to be needed by an individual

Will this affect any other features?
Anywhere 'link' is used should be replaced but no other feature will be affected.

Any other information?

Clean Service Provider

The service provider has a lot going on in single methods. These should be extracted to class methods in sensible groups.

Use sign instead of generate

What will the feature achieve?
Allow a link to be created using ::sign instead of ::generate

Why is this necessary?
::sign is cleaner and easier to remember than generate

How should the feature work?
A sign method should be declared in the UrlSigner, acting as an alias for the generate method

Will this affect any other features?
No, since sign will just be an alias and not change generate in any way.

Any other information?

Register Alias

What will the feature achieve?
Allow for easier access to the Facade through use of an alias

Why is this necessary?
This will remove the need to import the facade.

How should the feature work
The package should automatically register an alias for the facade

** Will this affect any other features**
No, since the alias is just another way to use the facade and the facade can still be used.

I am using laravel 5.6. So when I install this package, getting follwing error "linkeys/signed-url v1.0.0 requires illuminate/config ~5.7.0|~5.8.0 "

What will the feature achieve?
e.g. Allow a user to [...]

Why is this necessary?
Why do you think this is a good idea? Who will it help?

How should the feature work?
Try and include as much information as you can about how you'd like the feature to be used.

Will this affect any other features?
e.g. This will replace the method [...]

Any other information?

spatie/url dependency

Any chance to update the spatie/url dependency in order to support recent versions of PHP?

╰─ composer require linkeys/signed-url                                                                                         ─╯
Using version ^5.0 for linkeys/signed-url

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - spatie/url 1.3.0 requires php ^7.0 -> your php version (8.2.5) does not satisfy that requirement.
    - spatie/url[1.3.1, ..., 1.3.3] require php ^7.2 -> your php version (8.2.5) does not satisfy that requirement.
    - spatie/url[1.3.4, ..., 1.3.5] require psr/http-message ^1.0 -> found psr/http-message[1.0, 1.0.1, 1.1] but the package is fixed to 2.0 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
    - linkeys/signed-url v5.0.0 requires spatie/url ^1.3 -> satisfiable by spatie/url[1.3.0, ..., 1.3.5].
    - Root composer.json requires linkeys/signed-url ^5.0 -> satisfiable by linkeys/signed-url[v5.0.0].

Removing/Reusing old links

What will the feature achieve?
Allow reusing existing records in the links table where the request previously existed or some process to delete old link from the links table.

Invalid alias defined in composer.json

Summary of the bug
This namespace is invalid and class does not exist which causes PHP warnings

"UrlSigner": "Linkeys\\UrlSigner\\Link"

PHP warning:

PHP Warning:  Class 'Linkeys\UrlSigner\Link' not found in .\vendor\laravel\framework\src\Illuminate\Foundation\AliasLoader.php on line 80

To Reproduce
Run

UrlSigner::sign('https://www.example.com/invitation')->url;

in Laravel Tinker after installing package and watch PHP warning appear.

Expected behaviour
No PHP warning.

Actual behaviour
PHP warning thrown.

Suggestion of a fix
Fix alias definition or remove, it doesn't seem like it's needed.

Reduce middleware dependence

Currently, the middleware must be run in the order

\Linkeys\UrlSigner\Middleware\AddLinkToRequest,
\Linkeys\UrlSigner\Middleware\AddLinkDataToRequest,
\Linkeys\UrlSigner\Middleware\CheckLinkUnchanged,
\Linkeys\UrlSigner\Middleware\CheckLinkValid

This could cause an issue since middleware order cannot be enforced.

Suggested Solution:

  • Resolve the link from the request in AddLinkDataToRequest, CheckLinkUnchanged, CheckLinkValid to remove dependency on AddLinkToRequest.

Rename facade

The facade should potentially be renamed to UrlSigner to keep consistency throughout the project

Foreign Keys in Table

The link table migration should optionally create foreign key constraints between the links and groups tables

Data not accessible in controller

Summary of the bug
Data is not accessible in controller

To Reproduce

  1. Create a link that contains some data
  2. Click on the link
  3. Try and access the data using $request->get('data');

Expected behaviour
The value of the 'data' key to be returned.

Actual behaviour
null was returned.

Additional context
The link is accessible in $request->get('link');. It's just the data left.

Suggestion of a fix
Add a new middleware to inject the data into the request, not just the link.

Package completely broken? Examples don't work.

Summary of the bug
I installed this package and ran the example:

$link = \Linkeys\UrlSigner\Facade\UrlSigner::generate('https://www.example.com/invitation');
echo $link; // https://www.example.com/invitation?uuid=UUID

This returns the Link instance as a JSON string. And not the URL to use as shown in the example.

To Reproduce
Install package in Laravel 8 project, run:

$link = \Linkeys\UrlSigner\Facade\UrlSigner::generate('https://www.example.com/invitation');
echo $link; // https://www.example.com/invitation?uuid=UUID

and watch as it gives you a JSON string.

Expected behaviour
Return string as shown.

Actual behaviour
Returns JSON string.

Laravel 10 support

What will the feature achieve?
Allow the upgrade of the Laravel framework to version 10

Why is this necessary?
Upgrade to Laravel 10

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.