Skip to content

Conversation

phclark
Copy link
Contributor

@phclark phclark commented Nov 15, 2024

Hey, I just made a Pull Request!

✔️ Checklist

  • A changeset describing the change and affected packages. (more info)
  • Added or updated documentation
  • Tests for new functionality and regression tests for bug fixes
  • Screenshots attached (for UI changes)
  • All your commits have a Signed-off-by line in the message. (more info)

Signed-off-by: Philip Clark <philip.clark@iterable.com>
@phclark phclark requested review from a team as code owners November 15, 2024 22:16
@phclark phclark requested review from jhaals and vinzscam November 15, 2024 22:16
@github-actions github-actions bot added the BEP Backstage Enhancement Proposals label Nov 15, 2024
phclark and others added 4 commits November 15, 2024 15:20
Signed-off-by: Philip Clark <philip.clark@iterable.com>
Signed-off-by: Philip Clark <philip.clark@iterable.com>
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
Copy link
Contributor

This PR has been automatically marked as stale because it has not had recent activity from the author. It will be closed if no further activity occurs. If the PR was closed and you want it re-opened, let us know and we'll re-open the PR so that you can continue the contribution!

Copy link
Contributor

This PR has been automatically marked as stale because it has not had recent activity from the author. It will be closed if no further activity occurs. If the PR was closed and you want it re-opened, let us know and we'll re-open the PR so that you can continue the contribution!

Copy link
Contributor

This PR has been automatically marked as stale because it has not had recent activity from the author. It will be closed if no further activity occurs. If the PR was closed and you want it re-opened, let us know and we'll re-open the PR so that you can continue the contribution!

@github-actions github-actions bot added the stale label Jan 13, 2025
@github-actions github-actions bot closed this Jan 20, 2025
@github-actions github-actions bot removed the stale label Mar 2, 2025
Copy link
Contributor

This PR has been automatically marked as stale because it has not had recent activity from the author. It will be closed if no further activity occurs. If the PR was closed and you want it re-opened, let us know and we'll re-open the PR so that you can continue the contribution!

List any dependencies that this work has on other BEPs or features.
-->

## Alternatives
Copy link
Member

Choose a reason for hiding this comment

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

Do you considered simply adding an extension point which allows to call the /userinfo endpoint of an identity provider` with the provided token?

That way the same data would be available like on the "normal" login. The token would be set in the auth-backend and mapped to the user.

This would have less risk as the Oauth2 device flow is maintained by dedicated products.

Copy link
Member

Choose a reason for hiding this comment

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

Could you elaborate? Do you mean being able to for example call /google/userinfo with a Google access token and get back the Backstage user info?

Not sure how standardized device auth implementations are tbh. Judging by many of our current OAuth integrations that would likely get really messy for the clients.

Another downside that I covered in #30066 is that proxy auth is often the best option for auth, and that session can't be forwarded. That said we could always require a secondary login for device flow to get around that.

Copy link
Member

Choose a reason for hiding this comment

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

The userinfo endpoint is part of the OIDC standard so it can be expected that most identity providers provide such an endpoint. AFAIK the userinfo endpoint returns the same information as with the login. Therefore this flow should be possible.

With externalAccess setup with a JWKS:

sequenceDiagram
User->>IDP: login / fetch token
User->>Backstage: API request with IDP token
Backstage->>Backstage: check if token has been validated before
Backstage->>IDP: call /userinfo endpoint and fetch details
Backstage->>Backstage: run signin resolver and apply permissions
Backstage->>User: return API response
Loading

Not sure how standardized device auth implementations are tbh. Judging by many of our current OAuth integrations that would likely get really messy for the clients.

With that application Backstage would not really care how the user obtained the token. In that case it would be more an ( optional ) extension of the externalAccess configuration.

Copy link
Member

Choose a reason for hiding this comment

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

That's roughly how the regular auth flow works today, but I don't quite see how it helps us with device auth? Device auth requires more of an ability for clients to initialize a decoupled auth flow that users can then approve, rather than initializing auth directly. In this flow the "login / fetch token" step would need to be the device auth flow, initialized towards Backstage. There would then be a second client that completes it towards Backstage and/or the IdP.

Copy link
Member

@secustor secustor Jun 1, 2025

Choose a reason for hiding this comment

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

That's roughly how the regular auth flow works today, but I don't quite see how it helps us with device auth?

Yes, that is the reason why I'm proposing it. The IdP would implement the actual authorization part and Backstage would have not to implement it as it its not the core functionality. IMO this should be offloaded as much to dedicated tools e.g. Keycloak or commercial offerings.

Device auth requires more of an ability for clients to initialize a decoupled auth flow that users can then approve, rather than initializing auth directly. In this flow the "login / fetch token" step would need to be the device auth flow, initialized towards Backstage. There would then be a second client that completes it towards Backstage and/or the IdP.

I think this is the question should Backstage fully implement the Device Flow or should the externalAccess JWKS option be extended to make use of the permission system.

backend:
  auth:
    externalAccess:
      - type: jwks
        options:
          url: https://another-example.com/.well-known/jwks.json
          issuer: https://example.com
+         userInfoPath: /userinfo

Alternatively a externalAccess type oidc:

backend:
  auth:
    externalAccess:
      - type: oidc
         options:
           url: https://another-example.com/

I think in the end both would work. So also happy if Backstage implements the DeviceAuth flow, but I simply think this will pull a lot of resources security wise 😄

Copy link
Contributor

This PR has been automatically marked as stale because it has not had recent activity from the author. It will be closed if no further activity occurs. If the PR was closed and you want it re-opened, let us know and we'll re-open the PR so that you can continue the contribution!

Copy link
Contributor

This PR has been automatically marked as stale because it has not had recent activity from the author. It will be closed if no further activity occurs. If the PR was closed and you want it re-opened, let us know and we'll re-open the PR so that you can continue the contribution!

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

Successfully merging this pull request may close these issues.

5 participants