Skip to content

Instantly share code, notes, and snippets.

@bryanaknight
Created March 1, 2016 21:13
Show Gist options
  • Select an option

  • Save bryanaknight/8e6aebe4348ea8c73771 to your computer and use it in GitHub Desktop.

Select an option

Save bryanaknight/8e6aebe4348ea8c73771 to your computer and use it in GitHub Desktop.

This PR is to spike out an implementation of including tenant_id when an email notification is generated so when we verify the generated and encoded token, we are connected to the correct tenant schema. We are proposing a globally available load_tenant!(tenant) method that is responsible for setting the tenant schema context, as opposed to passing a tenant_id throughout the entire mail reply code path.

###Questions

How do we support existing signed auth tokens that do not include a tenant_id?

An approach that we discussed is to add a new PACK_FORMAT to use for newly generated tokens (those that include tenant_id going forward) so we can differentiate between pre-tenant and post-tenant tokens. This may warrant new GitHub::Authentication::SignedAuthToken version. Pre-tenant tokens will signal to us that the applicable tenant is GitHub, and for post-tenant tokens we'll parse and retrieve the tenant_id from the token. We can then connect to the appopriate tenant schema.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment