Oauth2 changes to support accessCode flow

Additional logic to support accessCode flow type, as well as minor bug
fixes to support the 2.0 spec.
This commit is contained in:
Brian Shamblen
2015-01-29 11:10:44 -08:00
parent b7a7607820
commit 93e5566267
9 changed files with 191 additions and 62 deletions

View File

@@ -1777,13 +1777,32 @@ SwaggerAuthorizations.prototype.apply = function (obj, authorizations) {
}
}
else {
for (name in authorizations) {
for (key in this.authz) {
if (key == name) {
value = this.authz[key];
result = value.apply(obj, authorizations);
if (result === true)
status = true;
// 2.0 support
if (Array.isArray(authorizations)) {
for (var i = 0; i < authorizations.length; i++) {
var auth = authorizations[i];
for (name in auth) {
for (key in this.authz) {
if (key == name) {
value = this.authz[key];
result = value.apply(obj, authorizations);
if (result === true)
status = true;
}
}
}
}
}
else {
// 1.2 support
for (name in authorizations) {
for (key in this.authz) {
if (key == name) {
value = this.authz[key];
result = value.apply(obj, authorizations);
if (result === true)
status = true;
}
}
}
}