@@ -32,11 +32,17 @@ import (
32
32
"github.com/ory/x/otelx"
33
33
)
34
34
35
- var _ registration.PostHookPostPersistExecutor = new (WebHook )
36
- var _ registration.PostHookPrePersistExecutor = new (WebHook )
37
- var _ verification.PostHookExecutor = new (WebHook )
38
- var _ recovery.PostHookExecutor = new (WebHook )
39
- var _ settings.PostHookPostPersistExecutor = new (WebHook )
35
+ var (
36
+ _ registration.PostHookPostPersistExecutor = new (WebHook )
37
+ _ registration.PostHookPrePersistExecutor = new (WebHook )
38
+
39
+ _ verification.PostHookExecutor = new (WebHook )
40
+
41
+ _ recovery.PostHookExecutor = new (WebHook )
42
+
43
+ _ settings.PostHookPostPersistExecutor = new (WebHook )
44
+ _ settings.PostHookPrePersistExecutor = new (WebHook )
45
+ )
40
46
41
47
type (
42
48
webHookDependencies interface {
@@ -155,6 +161,10 @@ func (e *WebHook) ExecuteRegistrationPreHook(_ http.ResponseWriter, req *http.Re
155
161
156
162
func (e * WebHook ) ExecutePostRegistrationPrePersistHook (_ http.ResponseWriter , req * http.Request , flow * registration.Flow , id * identity.Identity ) error {
157
163
ctx , _ := e .deps .Tracer (req .Context ()).Tracer ().Start (req .Context (), "selfservice.hook.ExecutePostRegistrationPrePersistHook" )
164
+ if ! gjson .GetBytes (e .conf , "can_interrupt" ).Bool () {
165
+ return nil
166
+ }
167
+
158
168
return e .execute (ctx , & templateContext {
159
169
Flow : flow ,
160
170
RequestHeaders : req .Header ,
@@ -166,6 +176,10 @@ func (e *WebHook) ExecutePostRegistrationPrePersistHook(_ http.ResponseWriter, r
166
176
167
177
func (e * WebHook ) ExecutePostRegistrationPostPersistHook (_ http.ResponseWriter , req * http.Request , flow * registration.Flow , session * session.Session ) error {
168
178
ctx , _ := e .deps .Tracer (req .Context ()).Tracer ().Start (req .Context (), "selfservice.hook.ExecutePostRegistrationPostPersistHook" )
179
+ if gjson .GetBytes (e .conf , "can_interrupt" ).Bool () {
180
+ return nil
181
+ }
182
+
169
183
return e .execute (ctx , & templateContext {
170
184
Flow : flow ,
171
185
RequestHeaders : req .Header ,
@@ -187,6 +201,25 @@ func (e *WebHook) ExecuteSettingsPreHook(_ http.ResponseWriter, req *http.Reques
187
201
188
202
func (e * WebHook ) ExecuteSettingsPostPersistHook (_ http.ResponseWriter , req * http.Request , flow * settings.Flow , id * identity.Identity ) error {
189
203
ctx , _ := e .deps .Tracer (req .Context ()).Tracer ().Start (req .Context (), "selfservice.hook.ExecuteSettingsPostPersistHook" )
204
+ if gjson .GetBytes (e .conf , "can_interrupt" ).Bool () {
205
+ return nil
206
+ }
207
+
208
+ return e .execute (ctx , & templateContext {
209
+ Flow : flow ,
210
+ RequestHeaders : req .Header ,
211
+ RequestMethod : req .Method ,
212
+ RequestURL : x .RequestURL (req ).String (),
213
+ Identity : id ,
214
+ })
215
+ }
216
+
217
+ func (e * WebHook ) ExecuteSettingsPrePersistHook (_ http.ResponseWriter , req * http.Request , flow * settings.Flow , id * identity.Identity ) error {
218
+ ctx , _ := e .deps .Tracer (req .Context ()).Tracer ().Start (req .Context (), "selfservice.hook.ExecuteSettingsPrePersistHook" )
219
+ if ! gjson .GetBytes (e .conf , "can_interrupt" ).Bool () {
220
+ return nil
221
+ }
222
+
190
223
return e .execute (ctx , & templateContext {
191
224
Flow : flow ,
192
225
RequestHeaders : req .Header ,
0 commit comments