@@ -117,34 +117,34 @@ describe("MetadataService", function() {
117117 } ) ;
118118
119119 } ) ;
120-
121- describe ( "getAuthorizationUrl " , function ( ) {
120+
121+ describe ( "getMetadataProperty " , function ( ) {
122122
123123 it ( "should return a promise" , function ( ) {
124- subject . getAuthorizationUrl ( ) . should . be . instanceof ( Promise ) ;
124+ subject . getMetadataProperty ( ) . should . be . instanceof ( Promise ) ;
125125 } ) ;
126126
127127 it ( "should use metadata on settings" , function ( done ) {
128128 settings . metadata = {
129- authorization_endpoint : "http://sts/authorize "
129+ foo : "test "
130130 } ;
131131
132- let p = subject . getAuthorizationUrl ( ) ;
132+ let p = subject . getMetadataProperty ( "foo" ) ;
133133
134134 p . then ( result => {
135- result . should . equal ( "http://sts/authorize " ) ;
135+ result . should . equal ( "test " ) ;
136136 done ( ) ;
137137 } ) ;
138138 } ) ;
139139
140- it ( "should fail if no authorization_endpoint on metadata" , function ( done ) {
140+ it ( "should fail if no data on metadata" , function ( done ) {
141141 settings . metadata = {
142142 } ;
143143
144- let p = subject . getAuthorizationUrl ( ) ;
144+ let p = subject . getMetadataProperty ( "foo" ) ;
145145
146146 p . then ( null , err => {
147- err . message . should . contain ( "authorization_endpoint " ) ;
147+ err . message . should . contain ( "foo " ) ;
148148 done ( ) ;
149149 } ) ;
150150 } ) ;
@@ -155,61 +155,65 @@ describe("MetadataService", function() {
155155 } ;
156156 stubJsonService . result = Promise . reject ( "test" ) ;
157157
158- let p = subject . getAuthorizationUrl ( ) ;
158+ let p = subject . getMetadataProperty ( "foo" ) ;
159159
160160 p . then ( null , err => {
161- err . message . should . contain ( "authorization " ) ;
161+ err . message . should . contain ( "foo " ) ;
162162 done ( ) ;
163163 } ) ;
164164 } ) ;
165165
166166 } ) ;
167167
168- describe ( "getUserInfoUrl" , function ( ) {
169-
170- it ( "should return a promise" , function ( ) {
171- subject . getUserInfoUrl ( ) . should . be . instanceof ( Promise ) ;
172- } ) ;
168+ describe ( "getAuthorizationEndpoint" , function ( ) {
173169
174- it ( "should use metadata on settings " , function ( done ) {
170+ it ( "should return value from metadata " , function ( done ) {
175171 settings . metadata = {
176- userinfo_endpoint : "http://sts/userinfo "
172+ authorization_endpoint : "http://sts/authorize "
177173 } ;
178174
179- let p = subject . getUserInfoUrl ( ) ;
175+ let p = subject . getAuthorizationEndpoint ( ) ;
180176
181177 p . then ( result => {
182- result . should . equal ( "http://sts/userinfo " ) ;
178+ result . should . equal ( "http://sts/authorize " ) ;
183179 done ( ) ;
184180 } ) ;
185181 } ) ;
182+
183+ } ) ;
184+
185+ describe ( "getUserInfoEndpoint" , function ( ) {
186186
187- it ( "should fail if no userinfo_endpoint on metadata " , function ( done ) {
187+ it ( "should return value from " , function ( done ) {
188188 settings . metadata = {
189+ userinfo_endpoint : "http://sts/userinfo"
189190 } ;
190191
191- let p = subject . getUserInfoUrl ( ) ;
192+ let p = subject . getUserInfoEndpoint ( ) ;
192193
193- p . then ( null , err => {
194- err . message . should . contain ( "userinfo_endpoint ") ;
194+ p . then ( result => {
195+ result . should . equal ( "http://sts/userinfo ") ;
195196 done ( ) ;
196197 } ) ;
197198 } ) ;
198-
199- it ( "should fail if json call to load metadata fails" , function ( done ) {
199+
200+ } ) ;
201+
202+ describe ( "getEndSessionEndpoint" , function ( ) {
203+
204+ it ( "should return value from" , function ( done ) {
200205 settings . metadata = {
201- metadataUrl : "http://sts/metadata "
206+ end_session_endpoint : "http://sts/signout "
202207 } ;
203- stubJsonService . result = Promise . reject ( "test" ) ;
204208
205- let p = subject . getUserInfoUrl ( ) ;
209+ let p = subject . getEndSessionEndpoint ( ) ;
206210
207- p . then ( null , err => {
208- err . message . should . contain ( "userinfo ") ;
211+ p . then ( result => {
212+ result . should . equal ( "http://sts/signout ") ;
209213 done ( ) ;
210214 } ) ;
211215 } ) ;
212-
216+
213217 } ) ;
214218
215219 describe ( "getSigningKeys" , function ( ) {
@@ -235,7 +239,7 @@ describe("MetadataService", function() {
235239 let p = subject . getSigningKeys ( ) ;
236240
237241 p . then ( null , err => {
238- err . message . should . contain ( 'jwks_uri ' ) ;
242+ err . message . should . contain ( 'signing keys ' ) ;
239243 done ( ) ;
240244 } ) ;
241245 } ) ;
0 commit comments