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 @@ -420,7 +420,20 @@ private async Task<JObject> GetIntrospectionPayloadAsync(string token)
420420 // See https://tools.ietf.org/html/rfc6749#section-2.3.1 for more information.
421421 else
422422 {
423- var credentials = Convert . ToBase64String ( Encoding . ASCII . GetBytes ( $ "{ Options . ClientId } :{ Options . ClientSecret } ") ) ;
423+ string EscapeDataString ( string value )
424+ {
425+ if ( string . IsNullOrEmpty ( value ) )
426+ {
427+ return null ;
428+ }
429+
430+ return Uri . EscapeDataString ( value ) . Replace ( "%20" , "+" ) ;
431+ }
432+
433+ var credentials = Convert . ToBase64String ( Encoding . ASCII . GetBytes (
434+ string . Concat (
435+ EscapeDataString ( Options . ClientId ) , ":" ,
436+ EscapeDataString ( Options . ClientSecret ) ) ) ) ;
424437
425438 request . Headers . Authorization = new AuthenticationHeaderValue ( OAuthIntrospectionConstants . Schemes . Basic , credentials ) ;
426439 }
Original file line number Diff line number Diff line change @@ -408,7 +408,20 @@ private async Task<JObject> GetIntrospectionPayloadAsync(string token)
408408 // See https://tools.ietf.org/html/rfc6749#section-2.3.1 for more information.
409409 else
410410 {
411- var credentials = Convert . ToBase64String ( Encoding . ASCII . GetBytes ( $ "{ Options . ClientId } :{ Options . ClientSecret } ") ) ;
411+ string EscapeDataString ( string value )
412+ {
413+ if ( string . IsNullOrEmpty ( value ) )
414+ {
415+ return null ;
416+ }
417+
418+ return Uri . EscapeDataString ( value ) . Replace ( "%20" , "+" ) ;
419+ }
420+
421+ var credentials = Convert . ToBase64String ( Encoding . ASCII . GetBytes (
422+ string . Concat (
423+ EscapeDataString ( Options . ClientId ) , ":" ,
424+ EscapeDataString ( Options . ClientSecret ) ) ) ) ;
412425
413426 request . Headers . Authorization = new AuthenticationHeaderValue ( OAuthIntrospectionConstants . Schemes . Basic , credentials ) ;
414427 }
You can’t perform that action at this time.
0 commit comments