Added directive support to getPublicKeys url function.
This commit is contained in:
parent
4d7167bee9
commit
4c9e70bd6f
|
@ -166,21 +166,19 @@ OAUTH3.urls.publicKeys = function(directive, opts) {
|
|||
if(!directive) {
|
||||
throw new Error("You must supply directives and opts");
|
||||
}
|
||||
if(!directive.JWKs) {
|
||||
//throw new Error("Provider does not support listing public keys.");
|
||||
if(!directive.retrieve_jwk) {
|
||||
throw new Error("Provider does not support retreiving public keys.");
|
||||
}
|
||||
if(!opts || (!opts.session && !opts.sub)) {
|
||||
throw new Error("You must supply options.session or a options.sub");
|
||||
}
|
||||
//TODO:
|
||||
//TODO: get the proper directive once it's created!!
|
||||
//TODO: Do we need to have sub strictly provided?
|
||||
var sub = opts.sub || opts.session.token.sub
|
||||
var hardCodedDir = "/api/issuer@oauth3.org/jwks/all/:sub";
|
||||
var url = OAUTH3.url.resolve(directive.api, hardCodedDir)
|
||||
url = url.replace(":sub", sub);
|
||||
|
||||
var method = opts.method || "GET";
|
||||
var sub = opts.sub || opts.session.token.sub;
|
||||
var dir = directive.retieve_jwk;
|
||||
var url = OAUTH3.url.resolve(directive.api, dir.url)
|
||||
.replace(":sub", sub);
|
||||
|
||||
var method = opts.method || dir.method || "GET";
|
||||
|
||||
return {
|
||||
method: method
|
||||
|
|
Loading…
Reference in New Issue