AuthN: add support for client specific hooks (#62863)

* AuthN: Add HookClient interface

* AuthN: Check if client implement authn.HookClient and call the hook if
it does

* AuthN: Convert refresh token hook into a client hook
This commit is contained in:
Karl Persson
2023-02-03 14:35:17 +01:00
committed by GitHub
parent 180a587f70
commit 6840cc11ff
6 changed files with 59 additions and 9 deletions
+2 -1
View File
@@ -15,6 +15,7 @@ import (
"github.com/grafana/grafana/pkg/web"
)
var _ authn.HookClient = new(Session)
var _ authn.ContextAwareClient = new(Session)
func ProvideSession(sessionService auth.UserTokenService, userService user.Service,
@@ -87,7 +88,7 @@ func (s *Session) Priority() uint {
return 60
}
func (s *Session) RefreshTokenHook(ctx context.Context, identity *authn.Identity, r *authn.Request) error {
func (s *Session) Hook(ctx context.Context, identity *authn.Identity, r *authn.Request) error {
if identity.SessionToken == nil {
return nil
}