update perl auth to skip null apikey/username&password

This commit is contained in:
wing328
2015-11-20 17:36:17 +08:00
parent c150247dca
commit 8303374aa5
3 changed files with 28 additions and 8 deletions

View File

@@ -317,18 +317,24 @@ sub update_params_for_auth {
foreach my $auth (@$auth_settings) {
# determine which one to use
if (!defined($auth)) {
# TODO show warning about auth setting not defined
}
elsif ($auth eq 'api_key') {
$header_params->{'api_key'} = $self->get_api_key_with_prefix('api_key');
my $api_key = $self->get_api_key_with_prefix('api_key');
if ($api_key) {
$header_params->{'api_key'} = $api_key;
}
}
elsif ($auth eq 'petstore_auth') {
$header_params->{'Authorization'} = 'Bearer ' . $WWW::SwaggerClient::Configuration::access_token;
if ($WWW::SwaggerClient::Configuration::access_token) {
$header_params->{'Authorization'} = 'Bearer ' . $WWW::SwaggerClient::Configuration::access_token;
}
}
else {
# TODO show warning about security definition not found
# TODO show warning about security definition not found
}
}
}

View File

@@ -37,7 +37,7 @@ has version_info => ( is => 'ro',
default => sub { {
app_name => 'Swagger Petstore',
app_version => '1.0.0',
generated_date => '2015-11-13T20:46:43.271Z',
generated_date => '2015-11-20T17:35:18.902+08:00',
generator_class => 'class io.swagger.codegen.languages.PerlClientCodegen',
} },
documentation => 'Information about the application version and the codegen codebase version'
@@ -103,7 +103,7 @@ Automatically generated by the Perl Swagger Codegen project:
=over 4
=item Build date: 2015-11-13T20:46:43.271Z
=item Build date: 2015-11-20T17:35:18.902+08:00
=item Build package: class io.swagger.codegen.languages.PerlClientCodegen