@websanova/vue-auth
Advanced tools
Comparing version
@@ -17,3 +17,3 @@ { | ||
"version": "1.0.2-dev", | ||
"version": "1.0.4-dev", | ||
@@ -46,3 +46,3 @@ "repository": { | ||
"replace-webpack-plugin": "0.1.2", | ||
"@websanova/vue-auth": "1.0.2-dev" | ||
"@websanova/vue-auth": "1.0.4-dev" | ||
}, | ||
@@ -49,0 +49,0 @@ |
@@ -81,12 +81,3 @@ var __utils = require('./lib/utils.js'), | ||
if (token) { | ||
if (this.options.authType === 'bearer') { | ||
this.options._setHeaders.call(this, req, { | ||
authorization: 'Bearer: ' + token | ||
}); | ||
} | ||
else if (this.options.authType === 'basic') { | ||
this.options._setHeaders.call(this, req, { | ||
authorization: token | ||
}); | ||
} | ||
this.options[this.options.authType + 'Auth'].request.call(this, req, token); | ||
} | ||
@@ -98,20 +89,8 @@ | ||
function _responseIntercept(res) { | ||
var token = ''; | ||
var token = this.options._getHeaders.call(this, res).authorization || this.options._httpData.call(this, res)[this.options.tokenVar]; | ||
token = this.options._getHeaders.call(this, res).authorization; | ||
if (token) { | ||
token = token.split('Bearer '); | ||
__token.set.call(this, null, token[token.length > 1 ? 1 : 0]); | ||
this.options[this.options.authType + 'Auth'].response.call(this, res, token); | ||
} | ||
token = this.options._httpData.call(this, res)[this.options.tokenVar]; | ||
if (token) { | ||
token = token.split('Bearer '); | ||
__token.set.call(this, null, token[token.length > 1 ? 1 : 0]); | ||
} | ||
if (this.options._invalidToken) { | ||
@@ -425,3 +404,29 @@ this.options._invalidToken.call(this, res); | ||
oauth2Perform: _oauth2Perform | ||
oauth2Perform: _oauth2Perform, | ||
// Auth drivers | ||
bearerAuth: { | ||
request: function (req, token) { | ||
this.options._setHeaders.call(this, req, { | ||
authorization: 'Bearer ' + token | ||
}); | ||
}, | ||
response: function (res, token) { | ||
var token = token.split('Bearer '); | ||
__token.set.call(this, null, token[token.length > 1 ? 1 : 0]); | ||
} | ||
}, | ||
basicAuth: { | ||
request: function (req, token) { | ||
this.options._setHeaders.call(this, req, { | ||
authorization: token | ||
}); | ||
}, | ||
response: function (res, token) { | ||
__token.set.call(this, null, token); | ||
} | ||
} | ||
}; | ||
@@ -428,0 +433,0 @@ |
10
todo.txt
-_invalidToken needs to be completed... | ||
-test as installed module (with mixbloom ?)... | ||
-reply to the dude | ||
* Compatibility with Vue 2.0. | ||
-reply to jeff guy. | ||
-stack overflow question about modules... | ||
-oauth1 | ||
--------------------------------------- |
Sorry, the diff of this file is not supported yet
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
3
-25%210361
-0.68%32
-3.03%2090
-2.29%