Skip to content

Commit

Permalink
add bearer auth support to csharp netcore (OpenAPITools#5921)
Browse files Browse the repository at this point in the history
  • Loading branch information
wing328 authored and michaelpro1 committed May 7, 2020
1 parent 85e7213 commit 924b545
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -325,13 +325,20 @@ namespace {{packageName}}.{{apiPackage}}
}
{{/isKeyInQuery}}
{{/isApiKey}}
{{#isBasic}}
{{#isBasicBasic}}
// http basic authentication required
if (!String.IsNullOrEmpty(this.Configuration.Username) || !String.IsNullOrEmpty(this.Configuration.Password))
{
localVarRequestOptions.HeaderParameters.Add("Authorization", "Basic " + {{packageName}}.Client.ClientUtils.Base64Encode(this.Configuration.Username + ":" + this.Configuration.Password));
}
{{/isBasic}}
{{/isBasicBasic}}
{{#isBasicBearer}}
// bearer authentication required
if (!String.IsNullOrEmpty(this.Configuration.AccessToken))
{
localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken);
}
{{/isBasicBearer}}
{{#isOAuth}}
// oauth required
if (!String.IsNullOrEmpty(this.Configuration.AccessToken))
Expand Down

0 comments on commit 924b545

Please sign in to comment.