Add Atlassian Identity to store identity/credentials
What does this MR do?
Related to #220991 (closed)
The new Atlassian Identity model and associated database table will allow GitLab users to connect their account to Atlassian Cloud. GitLab will then store the OAuth token and refresh token so GitLab can interact with Atlassian JIRA via the API. This will enable further integrations beyond authentication in the future.
I did not include any model or other tests yet since there's no usable functionality built around this yet. Functionality + tests will come with the follow-up MR !40178 (merged)
Migration
Migrate
== 20200821194920 CreateAtlassianIdentities: migrating ========================
-- table_exists?(:atlassian_identities)
-> 0.0008s
-- create_table(:atlassian_identities)
-> 0.0109s
-- transaction_open?()
-> 0.0000s
-- execute("ALTER TABLE atlassian_identities\nADD CONSTRAINT check_32f5779763\nCHECK ( char_length(extern_uid) <= 255 )\nNOT VALID;\n")
-> 0.0005s
-- execute("ALTER TABLE atlassian_identities VALIDATE CONSTRAINT check_32f5779763;")
-> 0.0006s
-- transaction_open?()
-> 0.0000s
-- execute("ALTER TABLE atlassian_identities\nADD CONSTRAINT atlassian_identities_token_length_constraint\nCHECK ( octet_length(encrypted_token) <= 2048 )\nNOT VALID;\n")
-> 0.0008s
-- execute("ALTER TABLE atlassian_identities VALIDATE CONSTRAINT atlassian_identities_token_length_constraint;")
-> 0.0005s
-- transaction_open?()
-> 0.0000s
-- execute("ALTER TABLE atlassian_identities\nADD CONSTRAINT atlassian_identities_token_iv_length_constraint\nCHECK ( octet_length(encrypted_token_iv) <= 12 )\nNOT VALID;\n")
-> 0.0004s
-- execute("ALTER TABLE atlassian_identities VALIDATE CONSTRAINT atlassian_identities_token_iv_length_constraint;")
-> 0.0005s
-- transaction_open?()
-> 0.0000s
-- execute("ALTER TABLE atlassian_identities\nADD CONSTRAINT atlassian_identities_refresh_token_length_constraint\nCHECK ( octet_length(encrypted_refresh_token) <= 512 )\nNOT VALID;\n")
-> 0.0005s
-- execute("ALTER TABLE atlassian_identities VALIDATE CONSTRAINT atlassian_identities_refresh_token_length_constraint;")
-> 0.0007s
-- transaction_open?()
-> 0.0000s
-- execute("ALTER TABLE atlassian_identities\nADD CONSTRAINT atlassian_identities_refresh_token_iv_length_constraint\nCHECK ( octet_length(encrypted_refresh_token_iv) <= 12 )\nNOT VALID;\n")
-> 0.0006s
-- execute("ALTER TABLE atlassian_identities VALIDATE CONSTRAINT atlassian_identities_refresh_token_iv_length_constraint;")
-> 0.0005s
== 20200821194920 CreateAtlassianIdentities: migrated (0.0374s) ===============
Rollback
== 20200821194920 CreateAtlassianIdentities: reverting ========================
-- drop_table(:atlassian_identities)
-> 0.0125s
== 20200821194920 CreateAtlassianIdentities: reverted (0.0227s) ===============
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry -
Documentation (if required) -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers -
Informed Infrastructure department of a default or new setting change, if applicable per definition of done
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
-
Label as security and @ mention @gitlab-com/gl-security/appsec
-
The MR includes necessary changes to maintain consistency between UI, API, email, or other methods -
Security reports checked/validated by a reviewer from the AppSec team
Edited by Drew Blessing