j'ai suivi ce blog pour JWT printemps oauth: https://medium.com/@nydiarra/secure-a-spring-boot-rest-api-with-json-web-token-reference-to-angular-integration-e57a25806c50Spring oauth navigateur JWT fonctionne en boucle ne
Dans un navigateur comme bord Chrome ou IE, quand je vais à https://infinite-tundra-6984.herokuapp.com/springjwt/cities, je suis invité à entrer le nom d'utilisateur et mot de passe.
Pour utilisateur standard:
Nom d'utilisateur: john.doe
Mot de passe: jwtpass
Pour Admin:
Nom d'utilisateur: admin.admin
Mot de passe: jwtpass
Cela fonctionne comme prévu.
Cependant, quand je CURL:
boucle testjwtclientid: [email protected]/oauth/token -d grant_type = mot de passe -d nom d'utilisateur = admin.admin mot de passe -d = jwtpass
je reçois un jeton comme: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOlsidGVzdGp3dHJlc291cmNlaWQiXSwidXNlcl9uYW1lIjoiYWRtaW4uYWRtaW4iLCJzY29wZSI6WyJyZWFkIiwid3JpdGUiXSwiZXhwIjoxNTA4MTMxNzQwLCJhdXRob3JpdGllcyI6WyJTVEFOREFSRF9VU0VSIiwiQURNSU5fVVNFUiJdLCJqdGkiOiIyNjVmYmY5OS0wYWU3LTQ0MmQtOThjNy03ZTkxMmFhYWZlNWYiLCJjbGllbnRfaWQiOiJ0ZXN0and0Y2xpZW50aWQifQ.exXHqinGAfoPYLFYxhiWIsEg1FSSHxw34Snxdk0AqnU
Alors je fais:
boucle https://infinite-tundra-6984.herokuapp.com/springjwt/cities -H "Autorisation: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOlsidGVzdGp3dHJlc291cmNlaWQiXSwidXNlcl9uYW1lIjoiYWRtaW4uYWRtaW4iLCJzY29wZSI6WyJyZWFkIiwid3JpdGUiXSwiZXhwIjoxNTA4MTMxNzQwLCJhdXRob3JpdGllcyI6WyJTVEFOREFSRF9VU0VSIiwiQURNSU5fVVNFUiJdLCJqdGkiOiIyNjVmYmY5OS0wYWU3LTQ0MmQtOThjNy03ZTkxMmFhYWZlNWYiLCJjbGllbnRfaWQiOiJ0ZXN0and0Y2xpZW50aWQifQ.exXHqinGAfoPYLFYxhiWIsEg1FSSHxw34Snxdk0AqnU"
je reçois un 401
Quelqu'un peut-il me donner quelques conseils sur les différences entre les deux façons d'accès sécurisé d contenu?
Il semble que, avec l'accès curl/jeton, il ne peut pas comprendre mon rôle