Skip to content

Fixes Geo Replication Details incorrectly empty

Michael Kozono requested to merge mk/fix-empty-replication-details-view into master

What does this MR do and why?

Fixes Geo Replication Details view so that it does not appear empty when there are records.

Also:

  • Move GraphQL authorization logic into RequestAuthenticator to centralize it again.
  • Centralize simple find_user_* methods into AuthFinders.

Resolves #468509 (closed)

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After
image image

GraphQL auth: Before bug

sequenceDiagram
    User->>+GraphqlController: /api/graphql execute action
    GraphqlController->>+SessionlessAuthentication: authenticate_sessionless_user(:api)
    SessionlessAuthentication->>+RequestAuthenticator: find_sessionless_user(:api) (overridden to try find_user_from_geo_token)
    RequestAuthenticator->>+RequestAuthenticator: Try many find_user_* methods
    SessionlessAuthentication->>+SessionlessAuthentication: sessionless_sign_in

GraphQL auth: During bug, before this MR

Notice that RequestAuthenticator#find_sessionless_user, and therefore find_user_from_geo_token, is bypassed.

sequenceDiagram
    User->>+GraphqlController: /api/graphql execute action
    GraphqlController->>+GraphqlController: authenticate_graphql
    GraphqlController->>+RequestAuthenticator: find_user_from_web_access_token
    GraphqlController->>+RequestAuthenticator: find_user_from_personal_access_token_for_api_or_git
    GraphqlController->>+GraphqlController: sessionless_sign_in

GraphQL auth: After

sequenceDiagram
    User->>+GraphqlController: /api/graphql execute action
    GraphqlController->>+SessionlessAuthentication: authenticate_sessionless_user(:graphql_api)
    SessionlessAuthentication->>+RequestAuthenticator: find_sessionless_user(:graphql_api)
    RequestAuthenticator->>+RequestAuthenticator: find_user_for_graphql_api_request(:graphql_api) (overridden to try find_user_from_geo_token)
    RequestAuthenticator->>+RequestAuthenticator: find_user_from_web_access_token
    RequestAuthenticator->>+RequestAuthenticator: find_user_from_personal_access_token_for_api_or_git
    SessionlessAuthentication->>+SessionlessAuthentication: sessionless_sign_in

Non-GraphQL auth: Before this MR

sequenceDiagram
    User->>+GraphqlController: /explore/projects/topics/<topic name>.atom show action
    GraphqlController->>+SessionlessAuthentication: authenticate_sessionless_user(:rss)
    SessionlessAuthentication->>+RequestAuthenticator: find_sessionless_user(:rss)
    RequestAuthenticator->>+RequestAuthenticator: Try many find_user_* methods
    SessionlessAuthentication->>+SessionlessAuthentication: sessionless_sign_in

Non-GraphQL auth: After (no behavior change)

sequenceDiagram
    User->>+GraphqlController: /explore/projects/topics/<topic name>.atom show action
    GraphqlController->>+SessionlessAuthentication: authenticate_sessionless_user(:rss)
    SessionlessAuthentication->>+RequestAuthenticator: find_sessionless_user(:rss)
    RequestAuthenticator->>+RequestAuthenticator: find_user_from_any_authentication_method(:rss)
    RequestAuthenticator->>+RequestAuthenticator: Try many find_user_* methods
    SessionlessAuthentication->>+SessionlessAuthentication: sessionless_sign_in

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

Visit /admin/geo/sites page with Geo set up, click into Replication Details of any data type that has data.

Edited by Michael Kozono

Merge request reports

Loading