@@ -17,7 +17,7 @@ describe('Strategy', function() {
17
17
var strategy , user , info ;
18
18
19
19
before ( function ( done ) {
20
- strategy = new Strategy ( { jwtFromRequest :extract_jwt . fromAuthHeader ( ) , secretOrKey : 'secret' } , function ( jwt_paylod , next ) {
20
+ strategy = new Strategy ( { jwtFromRequest :extract_jwt . fromAuthHeaderAsBearerToken ( ) , secretOrKey : 'secret' } , function ( jwt_paylod , next ) {
21
21
return next ( null , { user_id : 1234567890 } , { foo :'bar' } ) ;
22
22
} ) ;
23
23
@@ -28,7 +28,7 @@ describe('Strategy', function() {
28
28
done ( ) ;
29
29
} )
30
30
. req ( function ( req ) {
31
- req . headers [ 'authorization' ] = "JWT " + test_data . valid_jwt . token ;
31
+ req . headers [ 'authorization' ] = "bearer " + test_data . valid_jwt . token ;
32
32
} )
33
33
. authenticate ( ) ;
34
34
} ) ;
@@ -54,7 +54,7 @@ describe('Strategy', function() {
54
54
var strategy , info ;
55
55
56
56
before ( function ( done ) {
57
- strategy = new Strategy ( { jwtFromRequest : extract_jwt . fromAuthHeader ( ) , secretOrKey : 'secret' } , function ( jwt_payload , next ) {
57
+ strategy = new Strategy ( { jwtFromRequest : extract_jwt . fromAuthHeaderAsBearerToken ( ) , secretOrKey : 'secret' } , function ( jwt_payload , next ) {
58
58
return next ( null , false , { message : 'invalid user' } ) ;
59
59
} ) ;
60
60
@@ -64,7 +64,7 @@ describe('Strategy', function() {
64
64
done ( ) ;
65
65
} )
66
66
. req ( function ( req ) {
67
- req . headers [ 'authorization' ] = "JWT " + test_data . valid_jwt . token ;
67
+ req . headers [ 'authorization' ] = "bearer " + test_data . valid_jwt . token ;
68
68
} )
69
69
. authenticate ( ) ;
70
70
} ) ;
@@ -84,7 +84,7 @@ describe('Strategy', function() {
84
84
var strategy , err ;
85
85
86
86
before ( function ( done ) {
87
- strategy = new Strategy ( { jwtFromRequest : extract_jwt . fromAuthHeader ( ) , secretOrKey : 'secrety' } , function ( jwt_payload , next ) {
87
+ strategy = new Strategy ( { jwtFromRequest : extract_jwt . fromAuthHeaderAsBearerToken ( ) , secretOrKey : 'secrety' } , function ( jwt_payload , next ) {
88
88
return next ( new Error ( "ERROR" ) , false , { message : 'invalid user' } ) ;
89
89
} ) ;
90
90
@@ -94,7 +94,7 @@ describe('Strategy', function() {
94
94
done ( ) ;
95
95
} )
96
96
. req ( function ( req ) {
97
- req . headers [ 'authorization' ] = "JWT " + test_data . valid_jwt . token ;
97
+ req . headers [ 'authorization' ] = "bearer " + test_data . valid_jwt . token ;
98
98
} )
99
99
. authenticate ( ) ;
100
100
} ) ;
@@ -113,7 +113,7 @@ describe('Strategy', function() {
113
113
var strategy , err ;
114
114
115
115
before ( function ( done ) {
116
- strategy = new Strategy ( { jwtFromRequest : extract_jwt . fromAuthHeader ( ) , secretOrKey : 'secret' } , function ( jwt_payload , next ) {
116
+ strategy = new Strategy ( { jwtFromRequest : extract_jwt . fromAuthHeaderAsBearerToken ( ) , secretOrKey : 'secret' } , function ( jwt_payload , next ) {
117
117
throw new Error ( "EXCEPTION" ) ;
118
118
} ) ;
119
119
@@ -123,7 +123,7 @@ describe('Strategy', function() {
123
123
done ( ) ;
124
124
} )
125
125
. req ( function ( req ) {
126
- req . headers [ 'authorization' ] = "JWT " + test_data . valid_jwt . token ;
126
+ req . headers [ 'authorization' ] = "bearer " + test_data . valid_jwt . token ;
127
127
} )
128
128
. authenticate ( ) ;
129
129
} ) ;
@@ -145,7 +145,7 @@ describe('Strategy', function() {
145
145
before ( function ( done ) {
146
146
opts = { passReqToCallback : true } ;
147
147
opts . secretOrKey = 'secret' ;
148
- opts . jwtFromRequest = extract_jwt . fromAuthHeader ( ) ;
148
+ opts . jwtFromRequest = extract_jwt . fromAuthHeaderAsBearerToken ( ) ;
149
149
strategy = new Strategy ( opts , function ( request , jwt_payload , next ) {
150
150
// Capture the value passed in as the request argument
151
151
request_arg = request ;
@@ -157,7 +157,7 @@ describe('Strategy', function() {
157
157
done ( ) ;
158
158
} )
159
159
. req ( function ( req ) {
160
- req . headers [ 'authorization' ] = "JWT " + test_data . valid_jwt . token ;
160
+ req . headers [ 'authorization' ] = "bearer " + test_data . valid_jwt . token ;
161
161
expected_request = req ;
162
162
} )
163
163
. authenticate ( ) ;
0 commit comments