Skip to content

Add authorization#17

Merged
ValentinFutterer merged 1 commit intoinitfrom
authorization
Nov 5, 2025
Merged

Add authorization#17
ValentinFutterer merged 1 commit intoinitfrom
authorization

Conversation

@ValentinFutterer
Copy link
Collaborator

@ValentinFutterer ValentinFutterer commented Sep 29, 2025

Added the security schema BearerAuth and activated it globally (for every endpoint).
I added no bearerFormat, since I assume that every tool would use different token types (e.g. DAMAP would use JWTs). Other options is to fixate on a single Format but that would need to be discussed

Closes #6

Copy link

@xiaoranzhou xiaoranzhou left a comment

Choose a reason for hiding this comment

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

from copilot:
Yes, the changes in your diff follow OpenAPI standards.

What was changed:

  1. Added Security Requirement at the Root Level

    security:
      - BearerAuth: []
  2. Added Security Scheme under components.securitySchemes

    securitySchemes:
      BearerAuth:
        type: http
        scheme: bearer
    • OpenAPI Standard: Under components.securitySchemes, you define security schemes used in the API.
    • Reference: OpenAPI Specification: Security Scheme Object
    • type: http and scheme: bearer are the correct values for bearer token (usually JWT) authentication.

Summary

  • The new fields are valid according to the OpenAPI 3.x specification.
  • Your syntax and structure are correct for declaring and using bearer authentication.

Result:
Your changes comply with OpenAPI standards. If you want to make it explicit that you are using JWT, you can add bearerFormat: JWT, but it is optional:

securitySchemes:
  BearerAuth:
    type: http
    scheme: bearer
    bearerFormat: JWT

Copy link
Collaborator

@briri briri left a comment

Choose a reason for hiding this comment

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

This looks good @ValentinFutterer. I like that you have defined it at the global level. Most endpoints (and future endpoints) will require authorization.

Do we want to provide overrides though for GET /dmps/{id} and GET /dmps so that DMP metadata can be fetched publicly without a token? My tool has the concept of public and private DMPs. It would of course be up to the tool to determine whether or not an unauthenticated caller can access the data

For example:

  /dmps/{id}:
    get:
      security:
        - {}              # allows unauthenticated access
        - BearerAuth: []  # also allows authenticated access

@ValentinFutterer
Copy link
Collaborator Author

Do we want to provide overrides though for GET /dmps/{id} and GET /dmps so that DMP metadata can be fetched publicly without a token? My tool has the concept of public and private DMPs. It would of course be up to the tool to determine whether or not an unauthenticated caller can access the data

For example:

  /dmps/{id}:
    get:
      security:
        - {}              # allows unauthenticated access
        - BearerAuth: []  # also allows authenticated access

I would advise against it, since to my understanding, code generators would produce only one unauthorized endpoint in this case. Depends on if others also need this.

@ValentinFutterer ValentinFutterer merged commit 170fd77 into init Nov 5, 2025
4 checks passed
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.

Proposal: API authentication

4 participants