Closed rusher2004 closed 4 months ago
This PR adds some real functionality to API user operations.
withResourceOwner
PUT /user/{username}
rusher2
Successful call to PUT /user/rusher2
PUT /user/rusher2
curl 'http://localhost:8080/user/rusher2' \ -X 'PUT' \ -H 'Accept: */*' \ -H 'Accept-Language: en-US,en;q=0.9' \ -H 'Connection: keep-alive' \ -H 'Cookie: sAccessToken=eyJraWQiOiJkLTE3MTMwMjIyNDI5NjQiLCJ0eXAiOiJKV1QiLCJ2ZXJzaW9uIjoiNCIsImFsZyI6IlJTMjU2In0.eyJpYXQiOjE3MTMyNDUxNzgsImV4cCI6MTcxMzI0ODY1OSwic3ViIjoiNjlmNDcxMjgtZDBjZS00NmQ2LTk4NjUtYjkzMGQ1ZWUxNDQ4IiwidElkIjoicHVibGljIiwic2Vzc2lvbkhhbmRsZSI6ImUxZWIzZjM2LTU1NDAtNDM5OS05NGE5LTE0YTFlODcwMDk0NiIsInJlZnJlc2hUb2tlbkhhc2gxIjoiY2QyMTBjMDNhYjJmYTRkMzAzYWNjMWY4ZDIwYzcwYmZmNTBiM2ViOTMzOTEzMWIwZDBhYThmNzg0NmZkYmVhZCIsInBhcmVudFJlZnJlc2hUb2tlbkhhc2gxIjpudWxsLCJhbnRpQ3NyZlRva2VuIjpudWxsLCJpc3MiOiJodHRwOi8vbG9jYWxob3N0OjgwODAvYXV0aCIsInN0LWV2Ijp7InQiOjE3MTMyNDUxNzg4NDksInYiOnRydWV9fQ.R8A9dvAgHruEsLC83W1oSqrPjGWWReuLmW6kRpR58s3xiKUnVBj5dF6gGzpORdPMd3qhgo0rKR7prNc_6uH6JOosplENqkoyceC1yGzIDtIe0ppaK222GAE3BHxakEO167_qP9gu2aZU_u5SnqILzj3iG2VtcroDaDgosFot_y8-bJzY6KnlVgEhftqV2jiyrNYB_p-3hQ4YtaF0ELFeZzNTqmFy7iWzh-_D4Z6lxaUjkAay24P7ZdmiSeEppLdcVZL9jvM_MsPSj-o9ILW_jzmGPRhsCRo4ufDdJhZYvT2QvnkcNRM1BuZ-9s5VQRslMwMPAXw2ATdB0YOROOQJKg; st-last-access-token-update=1713245179111; sFrontToken=eyJ1aWQiOiI2OWY0NzEyOC1kMGNlLTQ2ZDYtOTg2NS1iOTMwZDVlZTE0NDgiLCJhdGUiOjE3MTMyNDg2NTkwMDAsInVwIjp7ImFudGlDc3JmVG9rZW4iOm51bGwsImV4cCI6MTcxMzI0ODY1OSwiaWF0IjoxNzEzMjQ1MTc4LCJpc3MiOiJodHRwOi8vbG9jYWxob3N0OjgwODAvYXV0aCIsInBhcmVudFJlZnJlc2hUb2tlbkhhc2gxIjpudWxsLCJyZWZyZXNoVG9rZW5IYXNoMSI6ImNkMjEwYzAzYWIyZmE0ZDMwM2FjYzFmOGQyMGM3MGJmZjUwYjNlYjkzMzkxMzFiMGQwYWE4Zjc4NDZmZGJlYWQiLCJzZXNzaW9uSGFuZGxlIjoiZTFlYjNmMzYtNTU0MC00Mzk5LTk0YTktMTRhMWU4NzAwOTQ2Iiwic3QtZXYiOnsidCI6MTcxMzI0NTE3ODg0OSwidiI6dHJ1ZX0sInN1YiI6IjY5ZjQ3MTI4LWQwY2UtNDZkNi05ODY1LWI5MzBkNWVlMTQ0OCIsInRJZCI6InB1YmxpYyJ9fQ==' \ -H 'Origin: http://localhost:3000' \ -H 'Referer: http://localhost:3000/' \ -H 'Sec-Fetch-Dest: empty' \ -H 'Sec-Fetch-Mode: cors' \ -H 'Sec-Fetch-Site: same-site' \ -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36' \ -H 'content-type: text/plain;charset=UTF-8' \ -H 'rid: anti-csrf' \ -H 'sec-ch-ua: "Google Chrome";v="123", "Not:A-Brand";v="8", "Chromium";v="123"' \ -H 'sec-ch-ua-mobile: ?0' \ -H 'sec-ch-ua-platform: "macOS"' \ -H 'st-auth-mode: cookie' \ --data-raw '{"firstName":"Robert","lastName":"Usher","username":"rusher2"}' | jq "." % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 200 100 138 100 62 234 105 --:--:-- --:--:-- --:--:-- 340 { "data": { "email": { "address": "rusher2004+jbdev2@gmail.com", "verified": true }, "firstName": "Robert", "lastName": "Usher", "username": "rusher2" } }
Successful failure to call PUT /user/rusher
PUT /user/rusher
curl 'http://localhost:8080/user/rusher' \ -X 'PUT' \ -H 'Accept: */*' \ -H 'Accept-Language: en-US,en;q=0.9' \ -H 'Connection: keep-alive' \ -H 'Cookie: sAccessToken=eyJraWQiOiJkLTE3MTMwMjIyNDI5NjQiLCJ0eXAiOiJKV1QiLCJ2ZXJzaW9uIjoiNCIsImFsZyI6IlJTMjU2In0.eyJpYXQiOjE3MTMyNDUxNzgsImV4cCI6MTcxMzI0ODY1OSwic3ViIjoiNjlmNDcxMjgtZDBjZS00NmQ2LTk4NjUtYjkzMGQ1ZWUxNDQ4IiwidElkIjoicHVibGljIiwic2Vzc2lvbkhhbmRsZSI6ImUxZWIzZjM2LTU1NDAtNDM5OS05NGE5LTE0YTFlODcwMDk0NiIsInJlZnJlc2hUb2tlbkhhc2gxIjoiY2QyMTBjMDNhYjJmYTRkMzAzYWNjMWY4ZDIwYzcwYmZmNTBiM2ViOTMzOTEzMWIwZDBhYThmNzg0NmZkYmVhZCIsInBhcmVudFJlZnJlc2hUb2tlbkhhc2gxIjpudWxsLCJhbnRpQ3NyZlRva2VuIjpudWxsLCJpc3MiOiJodHRwOi8vbG9jYWxob3N0OjgwODAvYXV0aCIsInN0LWV2Ijp7InQiOjE3MTMyNDUxNzg4NDksInYiOnRydWV9fQ.R8A9dvAgHruEsLC83W1oSqrPjGWWReuLmW6kRpR58s3xiKUnVBj5dF6gGzpORdPMd3qhgo0rKR7prNc_6uH6JOosplENqkoyceC1yGzIDtIe0ppaK222GAE3BHxakEO167_qP9gu2aZU_u5SnqILzj3iG2VtcroDaDgosFot_y8-bJzY6KnlVgEhftqV2jiyrNYB_p-3hQ4YtaF0ELFeZzNTqmFy7iWzh-_D4Z6lxaUjkAay24P7ZdmiSeEppLdcVZL9jvM_MsPSj-o9ILW_jzmGPRhsCRo4ufDdJhZYvT2QvnkcNRM1BuZ-9s5VQRslMwMPAXw2ATdB0YOROOQJKg; st-last-access-token-update=1713245179111; sFrontToken=eyJ1aWQiOiI2OWY0NzEyOC1kMGNlLTQ2ZDYtOTg2NS1iOTMwZDVlZTE0NDgiLCJhdGUiOjE3MTMyNDg2NTkwMDAsInVwIjp7ImFudGlDc3JmVG9rZW4iOm51bGwsImV4cCI6MTcxMzI0ODY1OSwiaWF0IjoxNzEzMjQ1MTc4LCJpc3MiOiJodHRwOi8vbG9jYWxob3N0OjgwODAvYXV0aCIsInBhcmVudFJlZnJlc2hUb2tlbkhhc2gxIjpudWxsLCJyZWZyZXNoVG9rZW5IYXNoMSI6ImNkMjEwYzAzYWIyZmE0ZDMwM2FjYzFmOGQyMGM3MGJmZjUwYjNlYjkzMzkxMzFiMGQwYWE4Zjc4NDZmZGJlYWQiLCJzZXNzaW9uSGFuZGxlIjoiZTFlYjNmMzYtNTU0MC00Mzk5LTk0YTktMTRhMWU4NzAwOTQ2Iiwic3QtZXYiOnsidCI6MTcxMzI0NTE3ODg0OSwidiI6dHJ1ZX0sInN1YiI6IjY5ZjQ3MTI4 <.... % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 110 100 48 100 62 1452 1876 --:--:-- --:--:-- --:--:-- 3235 { "error": "accountOwner does not match request" }
The latest updates on your projects. Learn more about Vercel for Git ↗︎
This PR adds some real functionality to API user operations.
withResourceOwner
middleware now allows for a route to fail if the requesting user owns the given resource.PUT /user/{username}
now actually putsTesting with user
rusher2
Successful call to
PUT /user/rusher2
Successful failure to call
PUT /user/rusher