This repository was archived by the owner on Dec 24, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +28
-2
lines changed
AspNet.Security.OAuth.Introspection
Owin.Security.OAuth.Introspection Expand file tree Collapse file tree 2 files changed +28
-2
lines changed Original file line number Diff line number Diff line change @@ -411,7 +411,20 @@ private async Task<JObject> GetIntrospectionPayloadAsync(string token)
411411 // See https://tools.ietf.org/html/rfc6749#section-2.3.1 for more information.
412412 else
413413 {
414- var credentials = Convert . ToBase64String ( Encoding . ASCII . GetBytes ( $ "{ Options . ClientId } :{ Options . ClientSecret } ") ) ;
414+ string EscapeDataString ( string value )
415+ {
416+ if ( string . IsNullOrEmpty ( value ) )
417+ {
418+ return null ;
419+ }
420+
421+ return Uri . EscapeDataString ( value ) . Replace ( "%20" , "+" ) ;
422+ }
423+
424+ var credentials = Convert . ToBase64String ( Encoding . ASCII . GetBytes (
425+ string . Concat (
426+ EscapeDataString ( Options . ClientId ) , ":" ,
427+ EscapeDataString ( Options . ClientSecret ) ) ) ) ;
415428
416429 request . Headers . Authorization = new AuthenticationHeaderValue ( OAuthIntrospectionConstants . Schemes . Basic , credentials ) ;
417430 }
Original file line number Diff line number Diff line change @@ -373,7 +373,20 @@ private async Task<JObject> GetIntrospectionPayloadAsync(string token)
373373 // See https://tools.ietf.org/html/rfc6749#section-2.3.1 for more information.
374374 else
375375 {
376- var credentials = Convert . ToBase64String ( Encoding . ASCII . GetBytes ( $ "{ Options . ClientId } :{ Options . ClientSecret } ") ) ;
376+ string EscapeDataString ( string value )
377+ {
378+ if ( string . IsNullOrEmpty ( value ) )
379+ {
380+ return null ;
381+ }
382+
383+ return Uri . EscapeDataString ( value ) . Replace ( "%20" , "+" ) ;
384+ }
385+
386+ var credentials = Convert . ToBase64String ( Encoding . ASCII . GetBytes (
387+ string . Concat (
388+ EscapeDataString ( Options . ClientId ) , ":" ,
389+ EscapeDataString ( Options . ClientSecret ) ) ) ) ;
377390
378391 request . Headers . Authorization = new AuthenticationHeaderValue ( OAuthIntrospectionConstants . Schemes . Basic , credentials ) ;
379392 }
You can’t perform that action at this time.
0 commit comments