Skip to content

KeyError: 'username' when authenticating with pulsar #373

@peterg1t

Description

@peterg1t

In the documentation an example of authentication and authorization is shown in https://pulsar.readthedocs.io/en/latest/configure.html

  authentication:
    - type: oidc
      oidc_jwks_url: https://login.microsoftonline.com/xxx/discovery/v2.0/keys
      oidc_provider: azure
      oidc_username_in_token: preferred_username
      oidc_username_template: *.
  authorization:
    - type: userlist
      userlist_allowed_users:
        - xxx

In my example I setup authorization only and when app.yml is configured with this I get the following error:

Sep 17 13:07:18 pulsar pulsar[176452]: Traceback (most recent call last):
Sep 17 13:07:18 pulsar pulsar[176452]:   File "/home/pulsar/venv/lib/python3.6/site-packages/pulsar/managers/stateful.py", line 135, in _handling_of_preprocessing_state
Sep 17 13:07:18 pulsar pulsar[176452]:     **launch_kwds
Sep 17 13:07:18 pulsar pulsar[176452]:   File "/home/pulsar/venv/lib/python3.6/site-packages/pulsar/managers/queued_drmaa.py", line 15, in launch
Sep 17 13:07:18 pulsar pulsar[176452]:     self._check_execution_with_tool_file(job_id, command_line)
Sep 17 13:07:18 pulsar pulsar[176452]:   File "/home/pulsar/venv/lib/python3.6/site-packages/pulsar/managers/base/directory.py", line 133, in _check_execution_with_tool_file
Sep 17 13:07:18 pulsar pulsar[176452]:     self._check_execution(job_id, tool_id, command_line)
Sep 17 13:07:18 pulsar pulsar[176452]:   File "/home/pulsar/venv/lib/python3.6/site-packages/pulsar/managers/base/__init__.py", line 183, in _check_execution
Sep 17 13:07:18 pulsar pulsar[176452]:     self.user_auth_manager.authorize(job_id, job_directory)
Sep 17 13:07:18 pulsar pulsar[176452]:   File "/home/pulsar/venv/lib/python3.6/site-packages/pulsar/user_auth/manager.py", line 42, in authorize
Sep 17 13:07:18 pulsar pulsar[176452]:     res = method.authorize(authentication_info)
Sep 17 13:07:18 pulsar pulsar[176452]:   File "/home/pulsar/venv/lib/python3.6/site-packages/pulsar/user_auth/methods/userlist.py", line 18, in authorize
Sep 17 13:07:18 pulsar pulsar[176452]:     return authentication_info["username"] in self._allowed_users
Sep 17 13:07:18 pulsar pulsar[176452]: KeyError: 'username'

This is my full config file:

amqp_publish_retry: true
amqp_publish_retry_interval_max: 60
amqp_publish_retry_interval_start: 10
amqp_publish_retry_interval_step: 10
amqp_publish_retry_max_retries: 5
user_auth:
    authorization:
        - type: userlist
          userlist_allowed_users:
              - pemartin
assign_ids: none
dependency_resolution:
    resolvers:
    -   auto_init: true
        auto_install: true
        type: conda
job_metrics_config_file: job_metrics_conf.xml
managers:
    _default_:
        production: true
        type: queued_drmaa
message_queue_url: pyamqp://?ssl=1
min_polling_interval: 0.5
persistence_directory: /home/pulsar/files/persisted_data
staging_directory: /home/pulsar/files/staging
tool_dependency_dir: /home/pulsar/deps

Is this a real issue or am I doing something wrong here? Thank you very much in advance for your help!

Pedro

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions