15
15
import io .jans .model .custom .script .conf .CustomScriptConfiguration ;
16
16
import io .jans .model .custom .script .type .token .UpdateTokenType ;
17
17
import io .jans .service .custom .script .ExternalScriptService ;
18
+ import jakarta .enterprise .context .ApplicationScoped ;
19
+ import jakarta .ws .rs .WebApplicationException ;
18
20
import org .jetbrains .annotations .NotNull ;
19
21
20
- import jakarta .enterprise .context .ApplicationScoped ;
21
22
import java .util .List ;
22
23
import java .util .function .Function ;
23
24
@@ -42,7 +43,10 @@ public boolean modifyIdTokenMethod(CustomScriptConfiguration script, JsonWebResp
42
43
final boolean result = updateTokenType .modifyIdToken (jsonWebResponse , context );
43
44
log .trace ("Finished 'updateToken' method, script name: {}, jsonWebResponse: {}, context: {}, result: {}" , script .getName (), jsonWebResponse , context , result );
44
45
46
+ context .throwWebApplicationExceptionIfSet ();
45
47
return result ;
48
+ } catch (WebApplicationException e ) {
49
+ throw e ;
46
50
} catch (Exception ex ) {
47
51
log .error (ex .getMessage (), ex );
48
52
saveScriptError (script .getCustomScript (), ex );
@@ -84,7 +88,10 @@ public int getRefreshTokenLifetimeInSeconds(CustomScriptConfiguration script, Ex
84
88
final int result = updateTokenType .getRefreshTokenLifetimeInSeconds (context );
85
89
log .trace ("Finished 'getRefreshTokenLifetimeInSeconds' method, script name: {}, context: {}, result: {}" , script .getName (), context , result );
86
90
91
+ context .throwWebApplicationExceptionIfSet ();
87
92
return result ;
93
+ } catch (WebApplicationException e ) {
94
+ throw e ;
88
95
} catch (Exception ex ) {
89
96
log .error (ex .getMessage (), ex );
90
97
saveScriptError (script .getCustomScript (), ex );
@@ -133,7 +140,10 @@ public boolean modifyRefreshToken(CustomScriptConfiguration script, RefreshToken
133
140
final boolean result = updateTokenType .modifyRefreshToken (refreshToken , context );
134
141
log .trace ("Finished 'modifyRefreshToken' method, script name: {}, context: {}, result: {}" , script .getName (), context , result );
135
142
143
+ context .throwWebApplicationExceptionIfSet ();
136
144
return result ;
145
+ } catch (WebApplicationException e ) {
146
+ throw e ;
137
147
} catch (Exception ex ) {
138
148
log .error (ex .getMessage (), ex );
139
149
saveScriptError (script .getCustomScript (), ex );
@@ -167,7 +177,10 @@ public boolean modifyAccessToken(CustomScriptConfiguration script, AccessToken a
167
177
final boolean result = updateTokenType .modifyAccessToken (accessToken , context );
168
178
log .trace ("Finished 'modifyAccessToken' method, script name: {}, context: {}, result: {}" , script .getName (), context , result );
169
179
180
+ context .throwWebApplicationExceptionIfSet ();
170
181
return result ;
182
+ } catch (WebApplicationException e ) {
183
+ throw e ;
171
184
} catch (Exception ex ) {
172
185
log .error (ex .getMessage (), ex );
173
186
saveScriptError (script .getCustomScript (), ex );
@@ -201,7 +214,10 @@ public int getAccessTokenLifetimeInSeconds(CustomScriptConfiguration script, Ext
201
214
final int result = updateTokenType .getAccessTokenLifetimeInSeconds (context );
202
215
log .trace ("Finished 'getAccessTokenLifetimeInSeconds' method, script name: {}, context: {}, result: {}" , script .getName (), context , result );
203
216
217
+ context .throwWebApplicationExceptionIfSet ();
204
218
return result ;
219
+ } catch (WebApplicationException e ) {
220
+ throw e ;
205
221
} catch (Exception ex ) {
206
222
log .error (ex .getMessage (), ex );
207
223
saveScriptError (script .getCustomScript (), ex );
@@ -235,7 +251,10 @@ public int getIdTokenLifetimeInSeconds(CustomScriptConfiguration script, Externa
235
251
final int result = updateTokenType .getIdTokenLifetimeInSeconds (context );
236
252
log .trace ("Finished 'getIdTokenLifetimeInSeconds' method, script name: {}, context: {}, result: {}" , script .getName (), context , result );
237
253
254
+ context .throwWebApplicationExceptionIfSet ();
238
255
return result ;
256
+ } catch (WebApplicationException e ) {
257
+ throw e ;
239
258
} catch (Exception ex ) {
240
259
log .error (ex .getMessage (), ex );
241
260
saveScriptError (script .getCustomScript (), ex );
0 commit comments