mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-11 09:02:43 +00:00
add oauth2 support for Perl
This commit is contained in:
@@ -323,7 +323,7 @@ sub update_params_for_auth {
|
||||
}
|
||||
{{#authMethods}}elsif ($auth eq '{{name}}') {
|
||||
{{#isApiKey}}{{#isKeyInHeader}}$header_params->{'{{keyParamName}}'} = $self->get_api_key_with_prefix('{{keyParamName}}');{{/isKeyInHeader}}{{#isKeyInQuery}}$query_params->{'{{keyParamName}}'} = $self->get_api_key_with_prefix('{{keyParamName}}');{{/isKeyInQuery}}{{/isApiKey}}{{#isBasic}}$header_params->{'Authorization'} = 'Basic '.encode_base64($WWW::{{moduleName}}::Configuration::username.":".$WWW::{{moduleName}}::Configuration::password);{{/isBasic}}
|
||||
{{#isOAuth}}# TODO support oauth{{/isOAuth}}
|
||||
{{#isOAuth}}$header_params->{'Authorization'} = 'Bearer ' . $WWW::{{moduleName}}::Configuration::access_token;{{/isOAuth}}
|
||||
}
|
||||
{{/authMethods}}
|
||||
else {
|
||||
|
||||
@@ -17,8 +17,12 @@ our $http_user_agent = 'Perl-Swagger';
|
||||
# authenticaiton setting
|
||||
our $api_key = {};
|
||||
our $api_key_prefix = {};
|
||||
our $username;
|
||||
our $password;
|
||||
|
||||
# username and password for HTTP basic authentication
|
||||
our $username = '';
|
||||
our $password = '';
|
||||
|
||||
# access token for OAuth
|
||||
our $access_token = '';
|
||||
|
||||
1;
|
||||
|
||||
Reference in New Issue
Block a user