Skip to content

Commit 166fac1

Browse files
committed
Release 3.0.0
1 parent edb8fb1 commit 166fac1

File tree

5 files changed

+57
-20
lines changed

5 files changed

+57
-20
lines changed

CHANGELOG.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
## Changelog
2+
3+
### 3.0.0 / 2015-06-01
4+
- [#48](https://github.com/seegno/angular-oauth2/pull/48) Update readme (@ruipenso)
5+
- [#25](https://github.com/seegno/angular-oauth2/pull/25) Replace ipCookie with ngCookies (@joaogranado)
6+
- [#28](https://github.com/seegno/angular-oauth2/pull/28) Add methods to get/set `token` property (@joaogranado)
7+
- [#47](https://github.com/seegno/angular-oauth2/pull/47) Add unauthorized error interception (@ruipenso)
8+
9+
### 2.1.1 / 2015-05-28
10+
- [#40](https://github.com/seegno/angular-oauth2/pull/40) Fix missing dependency on readme example (@ruipenso)
11+
12+
### 2.1.0 / 2015-03-09
13+
- [#15](https://github.com/seegno/angular-oauth2/pull/15) Add `clientSecret` as optional (@ruipenso)
14+
- [#18](https://github.com/seegno/angular-oauth2/pull/18) Remove npm postinstall script (@ruipenso)
15+
- [#14](https://github.com/seegno/angular-oauth2/pull/14) Fix readme configuration (@ruipenso)
16+
17+
### 2.0.0 / 2015-02-04
18+
- [#11](https://github.com/seegno/angular-oauth2/pull/11) Add options to `ipCookie.remove()` on OAuthToken (@ruipenso)
19+
- [#10](https://github.com/seegno/angular-oauth2/pull/10) Update `oauthInterceptor` responseError handling (@ruipenso)
20+
- [#7](https://github.com/seegno/angular-oauth2/pull/7) Fix readme typo of download url (@brunnolou)
21+
- [#6](https://github.com/seegno/angular-oauth2/pull/6) README.md: typo fix (@AdirAmsalem)
22+
23+
### 1.0.2 / 2015-01-19
24+
- [#4](https://github.com/seegno/angular-oauth2/pull/4) Add support for higher dependencies versions (@joaogranado)
25+
26+
### 1.0.1 / 2015-01-19
27+
- [#3](https://github.com/seegno/angular-oauth2/pull/3) Fix bower ignore list (@ruipenso)
28+
29+
### 1.0.0 / 2015-01-18
30+
- [#2](https://github.com/seegno/angular-oauth2/pull/2) Fix indentation in README examples (@fixe)
31+
- [#1](https://github.com/seegno/angular-oauth2/pull/1) Add project structure (@ruipenso)

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-oauth2",
3-
"version": "2.1.1",
3+
"version": "3.0.0",
44
"description": "AngularJS OAuth2",
55
"main": "./dist/angular-oauth2.js",
66
"authors": [

dist/angular-oauth2.js

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* angular-oauth2 - Angular OAuth2
3-
* @version v2.1.1
3+
* @version v3.0.0
44
* @link https://github.com/seegno/angular-oauth2
55
* @license MIT
66
*/
@@ -13,7 +13,7 @@
1313
root.angularOAuth2 = factory(root.angular, root.queryString);
1414
}
1515
})(this, function(angular, queryString) {
16-
var ngModule = angular.module("angular-oauth2", [ "ipCookie" ]).config(oauthConfig).factory("oauthInterceptor", oauthInterceptor).provider("OAuth", OAuthProvider).provider("OAuthToken", OAuthTokenProvider);
16+
var ngModule = angular.module("angular-oauth2", [ "ngCookies" ]).config(oauthConfig).factory("oauthInterceptor", oauthInterceptor).provider("OAuth", OAuthProvider).provider("OAuthToken", OAuthTokenProvider);
1717
function oauthConfig($httpProvider) {
1818
$httpProvider.interceptors.push("oauthInterceptor");
1919
}
@@ -32,7 +32,7 @@
3232
OAuthToken.removeToken();
3333
$rootScope.$emit("oauth:error", rejection);
3434
}
35-
if (401 === rejection.status && rejection.data && "invalid_token" === rejection.data.error) {
35+
if (401 === rejection.status && (rejection.data && "invalid_token" === rejection.data.error) || rejection.headers("www-authenticate") && 0 === rejection.headers("www-authenticate").indexOf("Bearer")) {
3636
$rootScope.$emit("oauth:error", rejection);
3737
}
3838
return $q.reject(rejection);
@@ -88,7 +88,7 @@
8888
_prototypeProperties(OAuth, null, {
8989
isAuthenticated: {
9090
value: function isAuthenticated() {
91-
return !!OAuthToken.token;
91+
return !!OAuthToken.getToken();
9292
},
9393
writable: true,
9494
enumerable: true,
@@ -115,7 +115,7 @@
115115
}
116116
}, options);
117117
return $http.post("" + config.baseUrl + "" + config.grantPath, data, options).then(function(response) {
118-
OAuthToken.token = response.data;
118+
OAuthToken.setToken(response.data);
119119
return response;
120120
});
121121
},
@@ -140,7 +140,7 @@
140140
}
141141
};
142142
return $http.post("" + config.baseUrl + "" + config.grantPath, data, options).then(function(response) {
143-
OAuthToken.token = response.data;
143+
OAuthToken.setToken(response.data);
144144
return response;
145145
});
146146
},
@@ -192,23 +192,29 @@
192192
angular.extend(config, params);
193193
return config;
194194
};
195-
this.$get = function(ipCookie) {
195+
this.$get = function($cookies) {
196196
var OAuthToken = function() {
197197
function OAuthToken() {}
198198
_prototypeProperties(OAuthToken, null, {
199-
token: {
200-
set: function(data) {
201-
return ipCookie(config.name, data, config.options);
199+
setToken: {
200+
value: function setToken(data) {
201+
return $cookies.putObject(config.name, data, config.options);
202202
},
203-
get: function() {
204-
return ipCookie(config.name);
203+
writable: true,
204+
enumerable: true,
205+
configurable: true
206+
},
207+
getToken: {
208+
value: function getToken() {
209+
return $cookies.getObject(config.name);
205210
},
211+
writable: true,
206212
enumerable: true,
207213
configurable: true
208214
},
209215
getAccessToken: {
210216
value: function getAccessToken() {
211-
return this.token ? this.token.access_token : undefined;
217+
return this.getToken() ? this.getToken().access_token : undefined;
212218
},
213219
writable: true,
214220
enumerable: true,
@@ -227,23 +233,23 @@
227233
},
228234
getRefreshToken: {
229235
value: function getRefreshToken() {
230-
return this.token ? this.token.refresh_token : undefined;
236+
return this.getToken() ? this.getToken().refresh_token : undefined;
231237
},
232238
writable: true,
233239
enumerable: true,
234240
configurable: true
235241
},
236242
getTokenType: {
237243
value: function getTokenType() {
238-
return this.token ? this.token.token_type : undefined;
244+
return this.getToken() ? this.getToken().token_type : undefined;
239245
},
240246
writable: true,
241247
enumerable: true,
242248
configurable: true
243249
},
244250
removeToken: {
245251
value: function removeToken() {
246-
return ipCookie.remove(config.name, angular.copy(config.options));
252+
return $cookies.remove(config.name, config.options);
247253
},
248254
writable: true,
249255
enumerable: true,
@@ -254,7 +260,7 @@
254260
}();
255261
return new OAuthToken();
256262
};
257-
this.$get.$inject = [ "ipCookie" ];
263+
this.$get.$inject = [ "$cookies" ];
258264
}
259265
return ngModule;
260266
});

dist/angular-oauth2.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-oauth2",
3-
"version": "2.1.1",
3+
"version": "3.0.0",
44
"description": "Angular OAuth2",
55
"main": "./dist/angular-oauth2.js",
66
"scripts": {

0 commit comments

Comments
 (0)