mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
* Manage service account secrets * Wip * WIP * WIP * Revert to keep a light interface * Implement SaveExternalService * Remove unecessary functions from the interface * Remove unused field * Better log * Leave ext svc credentials out of the extsvcauth package for now * Remove todo * Add tests to SaveExternalService * Test that secret has been removed from store * Lint * Nit. * Rename commands and structs Co-authored-by: Kalle Persson <kalle.persson@grafana.com> * Account for PR feedback Co-authored-by: Andres Martinez Gotor <andres.martinez@grafana.com> * Linting * Add nosec comment G101 - this is not a hardcoded secret * Lowercase kvStoreType --------- Co-authored-by: Kalle Persson <kalle.persson@grafana.com> Co-authored-by: Andres Martinez Gotor <andres.martinez@grafana.com>
39 lines
705 B
Go
39 lines
705 B
Go
package extsvcaccounts
|
|
|
|
import (
|
|
"github.com/grafana/grafana/pkg/models/roletype"
|
|
ac "github.com/grafana/grafana/pkg/services/accesscontrol"
|
|
)
|
|
|
|
const (
|
|
kvStoreType = "extsvc-token"
|
|
// #nosec G101 - this is not a hardcoded secret
|
|
tokenNamePrefix = "extsvc-token"
|
|
)
|
|
|
|
// Credentials represents the credentials associated to an external service
|
|
type Credentials struct {
|
|
Secret string
|
|
}
|
|
|
|
type SaveCredentialsCmd struct {
|
|
ExtSvcSlug string
|
|
OrgID int64
|
|
Secret string
|
|
}
|
|
|
|
type saveCmd struct {
|
|
ExtSvcSlug string
|
|
OrgID int64
|
|
Permissions []ac.Permission
|
|
SaID int64
|
|
}
|
|
|
|
func newRole(r roletype.RoleType) *roletype.RoleType {
|
|
return &r
|
|
}
|
|
|
|
func newBool(b bool) *bool {
|
|
return &b
|
|
}
|