Authz: Remove legacy API Key permissions (#110860)
* remove API key roles * remove API key gen * remove frontend and doc mentions * restore legacy keygen * restore codeowners * prettier * update swagger * remove permissions including apikeys * add migrator for removing deprecated permissions * add tracing * update openapi3 * simplify migrator for now * accesscontrol/migrator: remove batching for deprecated permissions deletion
This commit is contained in:
@@ -3,13 +3,11 @@ package apikeygen
|
||||
import (
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
|
||||
"github.com/grafana/grafana/pkg/components/satokengen"
|
||||
"github.com/grafana/grafana/pkg/util"
|
||||
)
|
||||
|
||||
var ErrInvalidApiKey = errors.New("invalid API key")
|
||||
|
||||
type KeyGenResult struct {
|
||||
HashedKey string
|
||||
ClientSecret string
|
||||
@@ -50,13 +48,13 @@ func New(orgId int64, name string) (KeyGenResult, error) {
|
||||
func Decode(keyString string) (*ApiKeyJson, error) {
|
||||
jsonString, err := base64.StdEncoding.DecodeString(keyString)
|
||||
if err != nil {
|
||||
return nil, ErrInvalidApiKey
|
||||
return nil, satokengen.ErrInvalidApiKey
|
||||
}
|
||||
|
||||
var keyObj ApiKeyJson
|
||||
err = json.Unmarshal(jsonString, &keyObj)
|
||||
if err != nil {
|
||||
return nil, ErrInvalidApiKey
|
||||
return nil, satokengen.ErrInvalidApiKey
|
||||
}
|
||||
|
||||
return &keyObj, nil
|
||||
|
||||
Reference in New Issue
Block a user