@@ -73,6 +73,14 @@ describe('RS256', function() {
73
73
} ) ;
74
74
} ) ;
75
75
76
+ it ( 'should check audience in array' , function ( done ) {
77
+ jwt . verify ( token , pub , { audience : [ 'urn:foo' , 'urn:other' ] } , function ( err , decoded ) {
78
+ assert . isNotNull ( decoded ) ;
79
+ assert . isNull ( err ) ;
80
+ done ( ) ;
81
+ } ) ;
82
+ } ) ;
83
+
76
84
it ( 'should throw when invalid audience' , function ( done ) {
77
85
jwt . verify ( token , pub , { audience : 'urn:wrong' } , function ( err , decoded ) {
78
86
assert . isUndefined ( decoded ) ;
@@ -81,6 +89,14 @@ describe('RS256', function() {
81
89
} ) ;
82
90
} ) ;
83
91
92
+ it ( 'should throw when invalid audience in array' , function ( done ) {
93
+ jwt . verify ( token , pub , { audience : [ 'urn:wrong' , 'urn:morewrong' ] } , function ( err , decoded ) {
94
+ assert . isUndefined ( decoded ) ;
95
+ assert . isNotNull ( err ) ;
96
+ done ( ) ;
97
+ } ) ;
98
+ } ) ;
99
+
84
100
} ) ;
85
101
86
102
describe ( 'when signing a token without audience' , function ( ) {
@@ -94,6 +110,14 @@ describe('RS256', function() {
94
110
} ) ;
95
111
} ) ;
96
112
113
+ it ( 'should check audience in array' , function ( done ) {
114
+ jwt . verify ( token , pub , { audience : [ 'urn:wrong' , 'urn:morewrong' ] } , function ( err , decoded ) {
115
+ assert . isUndefined ( decoded ) ;
116
+ assert . isNotNull ( err ) ;
117
+ done ( ) ;
118
+ } ) ;
119
+ } ) ;
120
+
97
121
} ) ;
98
122
99
123
describe ( 'when signing a token with issuer' , function ( ) {
0 commit comments