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

Fixed session support #45

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Fixed session support #45

wants to merge 3 commits into from

Conversation

pobocks
Copy link
Member

@pobocks pobocks commented Mar 29, 2024

This PR updates ASnake to support directly providing a session token in configuration or as an argument to the client/abstraction layer constructors. This is intended to provide support for the following use cases

  • sharing session tokens granted to a centralized auth service between applications
  • using proxies that take authentication via an API token
  • potentially adapting ASnake to work with ASpace instances using auth plugins that don't use username/password (SSO plugins)

dependabot bot and others added 3 commits February 10, 2023 23:17
Bumps [ipython](https://github.com/ipython/ipython) from 7.18.1 to 8.10.0.
- [Release notes](https://github.com/ipython/ipython/releases)
- [Commits](ipython/ipython@7.18.1...8.10.0)

---
updated-dependencies:
- dependency-name: ipython
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
In order to support proxies, shared session tokesn, and other
authorization schemes, this commit supports supplying either
username/password as before OR a session_token argument/config key.
Copy link
Collaborator

@bonniegee bonniegee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! A couple of small suggestions (one of which I may be wrong about), mostly in the documentation.


An example .archivessnake.yml file:
An minimal example of an .archivessnake.yml file:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is very minor, but "an" should be changed to "a."

| `retry_with_auth` | Whether to respond to 403 errors by trying to authorize and retrying | True |
| `logging_config` | Hash with various config values for the logging subsystem | **see below** |

`username`/`password` and `session_token` are mutually exclusive. In a normally configured ArchivesSpace system, you will want to use `username`/`password`. `session_token` allows you to set a fixed value for the session, in case you are sharing a long-lived session amongst several apps, or using an authorization customization that bypasses the ArchivesSpace login route. Examples of this include proxies or SSO plugins. `session_header_name` lets you customize the header you pass the session in, since some proxies use a different header than `X-ArchivesSpace-Session`.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be worth being more explicit that a config file can't have a username and a session token. A user may expect behavior such as one being used by default, or being able to choose the authorization method while running ArchivesSnake. I don't think either are necessary, but it might make sense to be explicit here.

log.debug('argument error in authorize')
raise ASnakeAuthError("Cannot set both username/password and session_token")

session_header_name = session_header_name or self.config['session_header_name']
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be self.config.get('session_header_name', None)?

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 this pull request may close these issues.

2 participants