Skip to content

Update TokenAuthenticatable with routable information

Overview

Following the Phase 4 Design Document we need to update TokenAuthenticatable with routing information and base64 encode that information.

It's going to be up to the caller to add the routing information.

Following the design document linked above we TokenAuthenticatable should have the following API:

class PersonalAccessToken
  add_authentication_token_field :token,
    encrypted: :required,
    format_with_prefix: :prefix_from_application_current_settings,
    routable_token: {       # New Option
      c: -> (token) { Gitlab.cell.id },
      o: -> (token) { token.user.user_preference.home_organization_id },
      u: -> (token) { token.user.id }
    }
end