Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Header authentication service configuration #437

Closed
soullivaneuh opened this issue Oct 31, 2023 · 2 comments · Fixed by #438
Closed

Header authentication service configuration #437

soullivaneuh opened this issue Oct 31, 2023 · 2 comments · Fixed by #438

Comments

@soullivaneuh
Copy link
Contributor

Description

The Header authentication service, introduced in php-http/message@144d13b, is present since v1.9.0 of its related package.

However, it is currently not possible to configure it through the bundle configuration:

switch ($config['type']) {
case 'basic':
$this->validateAuthenticationType(['username', 'password'], $config, 'basic');
break;
case 'bearer':
$this->validateAuthenticationType(['token'], $config, 'bearer');
break;
case 'service':
$this->validateAuthenticationType(['service'], $config, 'service');
break;
case 'wsse':
$this->validateAuthenticationType(['username', 'password'], $config, 'wsse');
break;
case 'query_param':
$this->validateAuthenticationType(['params'], $config, 'query_param');
break;
}

Example

httplug:
  clients:
    sample:
      # ...
      plugins:
        - base_uri:
            uri: "%env(SAMPLE_API_URL)%"
        - authentication:
            header:
              type: header
              name: "ApiKey"
              token: "%env(SAMPLE_API_TOKEN)%"
@dbu
Copy link
Collaborator

dbu commented Oct 31, 2023

yeah, that is missing. the place in the configuration you linked is where we should add it indeed.

and update the documentation here and here

for your proposed configuration format, i would make it consistent with the name in the authentication class, so it would be

  - authentication:
      header:
          type: header
          name: "ApiKey"
          value: "%env(SAMPLE_API_TOKEN)%"

do you want to do a pull request for it?

@soullivaneuh
Copy link
Contributor Author

Working on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants