From 0bfd11856746958e70ae3e1fd54ae1d5fe09946e Mon Sep 17 00:00:00 2001 From: Graham Gilchrist Date: Fri, 23 May 2014 11:06:53 +0100 Subject: [PATCH 1/5] Add auth-header-prefix option To support oAuth 2.0 style bearer authorization header needs to be of the form "Authorization: Bearer XXXtokenXXXXX" --- angular_token_auth.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/angular_token_auth.js b/angular_token_auth.js index 12c52b3..31e90f5 100644 --- a/angular_token_auth.js +++ b/angular_token_auth.js @@ -8,7 +8,8 @@ ENDPOINT: '/auth/', LOGIN: '/login/', LOGOUT: '/logout/', - LOGIN_REDIRECT_URL: '/' + LOGIN_REDIRECT_URL: '/', + AUTH_HEADER_PREFIX: 'Token' }); auth.config(['$routeProvider', 'TOKEN_AUTH', 'PROJECT_SETTINGS', function ($routeProvider, TOKEN_AUTH, PROJECT_SETTINGS) { @@ -25,13 +26,15 @@ }); }]); - auth.factory('authInterceptor', ['$rootScope', '$q', 'tokenFactory', function ($rootScope, $q, tokenFactory) { + auth.factory('authInterceptor', ['$rootScope', '$q', 'tokenFactory', 'TOKEN_AUTH', 'PROJECT_SETTINGS', function ($rootScope, $q, tokenFactory, TOKEN_AUTH, PROJECT_SETTINGS) { + var MODULE_SETTINGS = angular.extend({}, TOKEN_AUTH, PROJECT_SETTINGS.TOKEN_AUTH); + return { request: function (config) { config.headers = config.headers || {}; var token = tokenFactory.getToken(); if (token) { - config.headers.Authorization = 'Token ' + token; + config.headers.Authorization = MODULE_SETTINGS.AUTH_HEADER_PREFIX + ' ' + token; } return config; }, From 80a51f4805427cb830c7223dd18821a1b2031ace Mon Sep 17 00:00:00 2001 From: Graham Gilchrist Date: Fri, 23 May 2014 11:09:05 +0100 Subject: [PATCH 2/5] Add v3.0.3 changes --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0cfdc72..f5a954f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # CHANGELOG +# 3.0.3 + +* Add option for authirsation header prefix to allow oAuth 2.0 bearer authorisation + # 3.0.2 * Only broadcast tokenAuth events after cookie manipulation. From 228aab67805e906ef798e9db4009036773d64219 Mon Sep 17 00:00:00 2001 From: Graham Gilchrist Date: Fri, 23 May 2014 11:10:33 +0100 Subject: [PATCH 3/5] Update version and add myself as contributor --- bower.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bower.json b/bower.json index 64abf64..c3ad1db 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "angular-token-auth", - "version": "3.0.2", + "version": "3.0.3", "main": "./angular_token_auth.js", "dependencies": { "angular": "~1.2", @@ -10,6 +10,7 @@ "authors": [ "Perry Roper ", "Anna Powell-Smith " + "Graham Gilchrist ", ], "license": "MIT", "ignore": [ From bb6f998e4e91c2315342b1b0013a0d9db566af4e Mon Sep 17 00:00:00 2001 From: Graham Gilchrist Date: Fri, 23 May 2014 11:11:30 +0100 Subject: [PATCH 4/5] Fix incorrect json format --- bower.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bower.json b/bower.json index c3ad1db..0f06985 100644 --- a/bower.json +++ b/bower.json @@ -9,8 +9,8 @@ "homepage": "https://github.com/incuna/angular-token-auth", "authors": [ "Perry Roper ", - "Anna Powell-Smith " - "Graham Gilchrist ", + "Anna Powell-Smith ", + "Graham Gilchrist " ], "license": "MIT", "ignore": [ From f40651959da380a45756027646013be15563b972 Mon Sep 17 00:00:00 2001 From: Graham Gilchrist Date: Fri, 23 May 2014 11:29:39 +0100 Subject: [PATCH 5/5] Fix spelling --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f5a954f..8bbde39 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ # 3.0.3 -* Add option for authirsation header prefix to allow oAuth 2.0 bearer authorisation +* Add option for authorisation header prefix to allow oAuth 2.0 bearer authorisation # 3.0.2