Auth: Introduce pre-logout hooks + add GCOM LogoutHook (#88475)

* Introduce preLogoutHooks in authn service

* Add gcom_logout_hook

* Config the api token from the Grafana config file

* Simplify

* Add tests for logout hook

* Clean up

* Update

* Address PR comment

* Fix
This commit is contained in:
Misi
2024-05-30 15:52:16 +02:00
committed by GitHub
parent de201c5cdd
commit ed6b3e9e7c
11 changed files with 161 additions and 2 deletions
+2
View File
@@ -46,6 +46,8 @@ func (f *FakeService) IsClientEnabled(name string) bool {
func (f *FakeService) RegisterPostAuthHook(hook authn.PostAuthHookFn, priority uint) {}
func (f *FakeService) RegisterPreLogoutHook(hook authn.PreLogoutHookFn, priority uint) {}
func (f *FakeService) Login(ctx context.Context, client string, r *authn.Request) (*authn.Identity, error) {
if f.ExpectedIdentities != nil {
if f.CurrentIndex >= len(f.ExpectedIdentities) {
+4
View File
@@ -46,6 +46,10 @@ func (m *MockService) RegisterPostLoginHook(hook authn.PostLoginHookFn, priority
panic("unimplemented")
}
func (m *MockService) RegisterPreLogoutHook(hook authn.PreLogoutHookFn, priority uint) {
panic("unimplemented")
}
func (*MockService) Logout(_ context.Context, _ identity.Requester, _ *usertoken.UserToken) (*authn.Redirect, error) {
panic("unimplemented")
}