fix token request (GET not POST)
This commit is contained in:
parent
f65905c9bd
commit
06b2ca9b74
58
dist/index.js
vendored
58
dist/index.js
vendored
@ -1794,59 +1794,6 @@ function isLoopbackAddress(host) {
|
||||
}
|
||||
//# sourceMappingURL=proxy.js.map
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 632:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = (data, opts = {}) => {
|
||||
const {
|
||||
sorted, skipIndex, ignorenull, skipBracket, useDot, whitespace = '+'
|
||||
} = opts;
|
||||
|
||||
const encode = value => String(value)
|
||||
.replace(/[^ !'()~*]/gu, encodeURIComponent)
|
||||
.replace(/ /g, whitespace)
|
||||
.replace(/[!'()~*]/g, ch =>
|
||||
`%${ch.charCodeAt().toString(16).slice(-2).toUpperCase()}`);
|
||||
|
||||
const keys = (obj, keyarr = Object.keys(obj)) =>
|
||||
sorted ? keyarr.sort() : keyarr;
|
||||
|
||||
const filterjoin = arr => arr.filter(e => e).join('&');
|
||||
|
||||
const objnest = (name, obj) => filterjoin(keys(obj).map(key => useDot
|
||||
? nest(`${name}.${key}`, obj[key])
|
||||
: nest(`${name}[${key}]`, obj[key])));
|
||||
|
||||
const arrnest = (name, arr, brackets = skipBracket ? '' : '[]') => arr.length
|
||||
? filterjoin(arr.map((elem, index) => skipIndex
|
||||
? nest(name + brackets, elem)
|
||||
: nest(name + '[' + index + ']', elem)))
|
||||
: encode(name + brackets);
|
||||
|
||||
const setnest = (name, set) => filterjoin(
|
||||
Array.from(set).map(elem => nest(name, elem)));
|
||||
|
||||
const nest = (name, value, type = typeof value, f = null) => {
|
||||
if (value === f)
|
||||
f = ignorenull ? f : encode(name) + '=' + f;
|
||||
else if (/string|number|boolean/.test(type))
|
||||
f = encode(name) + '=' + encode(value);
|
||||
else if (Array.isArray(value))
|
||||
f = arrnest(name, value);
|
||||
else if (value instanceof Set)
|
||||
f = setnest(name, value);
|
||||
else if (type === 'object')
|
||||
f = objnest(name, value);
|
||||
|
||||
return f;
|
||||
};
|
||||
|
||||
return data && filterjoin(keys(data).map(key => nest(key, data[key])));
|
||||
};
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 294:
|
||||
@ -2917,7 +2864,6 @@ const core = __nccwpck_require__(186);
|
||||
const http = __nccwpck_require__(685);
|
||||
const https = __nccwpck_require__(687);
|
||||
const querystring = __nccwpck_require__(477);
|
||||
const form_urlencoded = __nccwpck_require__(632);
|
||||
|
||||
const req_timeout_ms = 30_000;
|
||||
const manifest_media_type = 'application/vnd.docker.distribution.manifest.v2+json';
|
||||
@ -3012,9 +2958,9 @@ async function get_token(www_authenticate, input) {
|
||||
password: input.password,
|
||||
};
|
||||
|
||||
const { status, headers, body } = await http_req('POST', params.realm, {
|
||||
const { status, headers, body } = await http_req('GET', params.realm + '?' + querystring.stringify(query_params), {
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
}, form_urlencoded(query_params));
|
||||
});
|
||||
|
||||
if (status !== 200) {
|
||||
console.error('get token response', { status, headers, body });
|
||||
|
2
dist/index.js.map
vendored
2
dist/index.js.map
vendored
File diff suppressed because one or more lines are too long
25
dist/licenses.txt
vendored
25
dist/licenses.txt
vendored
@ -35,31 +35,6 @@ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
|
||||
form-urlencoded
|
||||
MIT
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) Bumblehead <chris@bumblehead.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the 'Software'), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is furnished to do
|
||||
so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
IN THE SOFTWARE.
|
||||
|
||||
|
||||
tunnel
|
||||
MIT
|
||||
The MIT License (MIT)
|
||||
|
5
index.js
5
index.js
@ -3,7 +3,6 @@ const core = require('@actions/core');
|
||||
const http = require('http');
|
||||
const https = require('https');
|
||||
const querystring = require('querystring');
|
||||
const form_urlencoded = require('form-urlencoded');
|
||||
|
||||
const req_timeout_ms = 30_000;
|
||||
const manifest_media_type = 'application/vnd.docker.distribution.manifest.v2+json';
|
||||
@ -98,9 +97,9 @@ async function get_token(www_authenticate, input) {
|
||||
password: input.password,
|
||||
};
|
||||
|
||||
const { status, headers, body } = await http_req('POST', params.realm, {
|
||||
const { status, headers, body } = await http_req('GET', params.realm + '?' + querystring.stringify(query_params), {
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
}, form_urlencoded(query_params));
|
||||
});
|
||||
|
||||
if (status !== 200) {
|
||||
console.error('get token response', { status, headers, body });
|
||||
|
8
package-lock.json
generated
8
package-lock.json
generated
@ -5,8 +5,7 @@
|
||||
"packages": {
|
||||
"": {
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.10.0",
|
||||
"form-urlencoded": "^6.1.0"
|
||||
"@actions/core": "^1.10.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vercel/ncc": "^0.36.1",
|
||||
@ -580,11 +579,6 @@
|
||||
"integrity": "sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/form-urlencoded": {
|
||||
"version": "6.1.0",
|
||||
"resolved": "https://registry.npmjs.org/form-urlencoded/-/form-urlencoded-6.1.0.tgz",
|
||||
"integrity": "sha512-lc1Qd9nnEewXKoiPjIA1n38M5STbyY6krgoegsg7SsAt2b98HZKe25KaJvKFBwQaOcmh8FP7JbXVC7gocZw+XQ=="
|
||||
},
|
||||
"node_modules/fs.realpath": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
|
||||
|
@ -6,8 +6,7 @@
|
||||
"all": "npm run lint && npm run prepare"
|
||||
},
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.10.0",
|
||||
"form-urlencoded": "^6.1.0"
|
||||
"@actions/core": "^1.10.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vercel/ncc": "^0.36.1",
|
||||
|
Loading…
x
Reference in New Issue
Block a user