sources/oauth: cancel currently active flows before redirecting out
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
		| @ -6,6 +6,7 @@ from django.urls import reverse | |||||||
| from django.views.generic import RedirectView | from django.views.generic import RedirectView | ||||||
| from structlog.stdlib import get_logger | from structlog.stdlib import get_logger | ||||||
|  |  | ||||||
|  | from authentik.flows.views import FlowExecutorView | ||||||
| from authentik.sources.oauth.models import OAuthSource | from authentik.sources.oauth.models import OAuthSource | ||||||
| from authentik.sources.oauth.views.base import OAuthClientMixin | from authentik.sources.oauth.views.base import OAuthClientMixin | ||||||
|  |  | ||||||
| @ -42,4 +43,5 @@ class OAuthRedirect(OAuthClientMixin, RedirectView): | |||||||
|                 raise Http404(f"source {slug} is not enabled.") |                 raise Http404(f"source {slug} is not enabled.") | ||||||
|             client = self.get_client(source, callback=self.get_callback_url(source)) |             client = self.get_client(source, callback=self.get_callback_url(source)) | ||||||
|             params = self.get_additional_parameters(source) |             params = self.get_additional_parameters(source) | ||||||
|  |             FlowExecutorView().cancel() | ||||||
|             return client.get_redirect_url(params) |             return client.get_redirect_url(params) | ||||||
|  | |||||||
| @ -121,7 +121,7 @@ func NewOAuthProxy(opts *options.Options, provider api.ProxyOutpostConfig, c *ht | |||||||
| 		redirectURL.Path = fmt.Sprintf("%s/callback", opts.ProxyPrefix) | 		redirectURL.Path = fmt.Sprintf("%s/callback", opts.ProxyPrefix) | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	logger.WithField("auth_url", opts.GetProvider().Data().LoginURL).WithField("client_id", opts.ClientID).Info("proxy instance configured") | 	logger.WithField("auth_url", opts.GetProvider().Data().LoginURL.String()).WithField("client_id", opts.ClientID).Info("proxy instance configured") | ||||||
|  |  | ||||||
| 	sessionChain := buildSessionChain(opts, sessionStore) | 	sessionChain := buildSessionChain(opts, sessionStore) | ||||||
|  |  | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user
	 Jens Langhammer
					Jens Langhammer