jwt-framework icon indicating copy to clipboard operation
jwt-framework copied to clipboard

Updating from the deprecated Jose\Easy\*

Open killua-eu opened this issue 2 years ago • 4 comments

Would you kindly provide some documentation on how to upgrade from Jose\Easy? There are so many classes and methods within the framework that I get lost on how to reimplement even the simplest things, such as

$jwt = Load::jws($accessToken) 
    ->algs(['RS256', 'RS512'])   
    ->exp()                
    ->iat(1000)          
    ->nbf(1000)         
    ->iss($relmUri) 
    ->keyset(new JWKSet($certs)) 
    ->run();       
$claims = $jwt->claims->all() ?? [];
$header = $jwt->header->all() ?? [];

Thanks lots in advance

killua-eu avatar Jun 18 '22 21:06 killua-eu

Hi,

The Easy component was removed in v3.0 See https://web-token.spomky-labs.com/migration-1/from-v1.x-to-v2.0-1#list-of-deprecations

There is no replacement for the moment.

Spomky avatar Jun 18 '22 21:06 Spomky

Oh, sorry for not typing things out better. I'm aware that Easy was dropped. My question aimed at how one would rewrite the 2.2 Easy code to use 3.0 classes.

killua-eu avatar Jun 18 '22 22:06 killua-eu

Actually, the v3.0 is quite boring: it is just the v2.x minus deprecated features plus dependency updates. It should be possible to use the same classes with a limited number of changes

Spomky avatar Jul 16 '22 14:07 Spomky

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Sep 20 '22 19:09 stale[bot]

@Spomky So what you're saying is that one should use the Easy classes still although it's being abandoned? I think the question of @killua-eu was more targeted to how a migration path could look from using Easy to whatever is suitable now. I have the feeling this wasn't really answered, but I might have missed something.

dreis2211 avatar Jan 11 '23 12:01 dreis2211

yup, I'm still stuck on version 2 because I couldn't see an easy migration path. The question was just how to rewrite

$jwt = Load::jws($accessToken) 
    ->algs(['RS256', 'RS512'])   
    ->exp()                
    ->iat(1000)          
    ->nbf(1000)         
    ->iss($relmUri) 
    ->keyset(new JWKSet($certs)) 
    ->run();    

in a way that Easy isn't used.

killua-eu avatar Mar 15 '23 20:03 killua-eu

Hi @killua-eu,

Excuse me, I completely missed answering your request. Please follw the link to see a working example where a token is loaded with the exact same verifications: https://phpsandbox.io/n/green-ben-quadinaros-gbahy I hope it will help you moving from 2.x to 3.x. I will take time to add examples in the migration page.

Spomky avatar Mar 16 '23 19:03 Spomky

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Apr 26 '23 02:04 stale[bot]

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

github-actions[bot] avatar Feb 25 '24 04:02 github-actions[bot]