Add oauth pass-thru option for datasources

This commit is contained in:
Sean Lafferty
2019-02-01 19:40:57 -05:00
parent 9e33f8b7c4
commit 5a59cdf0ef
12 changed files with 312 additions and 7 deletions
@@ -33,6 +33,7 @@ func AddMigrations(mg *Migrator) {
addUserAuthMigrations(mg)
addServerlockMigrations(mg)
addUserAuthTokenMigrations(mg)
addUserAuthOAuthMigrations(mg)
}
func addMigrationLogMigrations(mg *Migrator) {
@@ -0,0 +1,25 @@
package migrations
import . "github.com/grafana/grafana/pkg/services/sqlstore/migrator"
func addUserAuthOAuthMigrations(mg *Migrator) {
userAuthV2 := Table{Name: "user_auth"}
mg.AddMigration("Add OAuth access token to user_auth", NewAddColumnMigration(userAuthV2, &Column{
Name: "o_auth_access_token", Type: DB_Text, Nullable: true, Length: 255,
}))
mg.AddMigration("Add OAuth refresh token to user_auth", NewAddColumnMigration(userAuthV2, &Column{
Name: "o_auth_refresh_token", Type: DB_Text, Nullable: true, Length: 255,
}))
mg.AddMigration("Add OAuth token type to user_auth", NewAddColumnMigration(userAuthV2, &Column{
Name: "o_auth_token_type", Type: DB_Text, Nullable: true, Length: 255,
}))
mg.AddMigration("Add OAuth expiry to user_auth", NewAddColumnMigration(userAuthV2, &Column{
Name: "o_auth_expiry", Type: DB_DateTime, Nullable: true,
}))
mg.AddMigration("Add index to user_id column in user_auth", NewAddIndexMigration(userAuthV2, &Index{
Cols: []string{"user_id"},
}))
}