/
PrivacyIDEAAuthenticator.java
611 lines (551 loc) · 24.9 KB
/
PrivacyIDEAAuthenticator.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
/*
* Copyright 2023 NetKnights GmbH - micha.preusser@netknights.it
* nils.behlen@netknights.it
* lukas.matusiewicz@netknights.it
* - Modified
* <p>
* Based on original code:
* <p>
* Copyright 2016 Red Hat, Inc. and/or its affiliates
* and other contributors as indicated by the @author tags.
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.privacyidea.authenticator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;
import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.core.Response;
import org.jboss.logging.Logger;
import org.keycloak.authentication.AuthenticationFlowContext;
import org.keycloak.authentication.AuthenticationFlowError;
import org.keycloak.authentication.AuthenticationFlowException;
import org.keycloak.forms.login.LoginFormsProvider;
import org.keycloak.models.GroupModel;
import org.keycloak.models.KeycloakSession;
import org.keycloak.models.RealmModel;
import org.keycloak.models.UserModel;
import org.privacyidea.Challenge;
import org.privacyidea.IPILogger;
import org.privacyidea.PIResponse;
import org.privacyidea.PrivacyIDEA;
import org.privacyidea.RolloutInfo;
import org.privacyidea.TokenInfo;
import org.privacyidea.U2F;
import static org.privacyidea.PIConstants.PASSWORD;
import static org.privacyidea.PIConstants.TOKEN_TYPE_PUSH;
import static org.privacyidea.PIConstants.TOKEN_TYPE_U2F;
import static org.privacyidea.PIConstants.TOKEN_TYPE_WEBAUTHN;
import static org.privacyidea.authenticator.Const.AUTH_NOTE_AUTH_COUNTER;
import static org.privacyidea.authenticator.Const.AUTH_NOTE_TRANSACTION_ID;
import static org.privacyidea.authenticator.Const.DEFAULT_OTP_MESSAGE_DE;
import static org.privacyidea.authenticator.Const.DEFAULT_OTP_MESSAGE_EN;
import static org.privacyidea.authenticator.Const.DEFAULT_PUSH_MESSAGE_DE;
import static org.privacyidea.authenticator.Const.DEFAULT_PUSH_MESSAGE_EN;
import static org.privacyidea.authenticator.Const.FORM_ERROR;
import static org.privacyidea.authenticator.Const.FORM_FILE_NAME;
import static org.privacyidea.authenticator.Const.FORM_IMAGE_OTP;
import static org.privacyidea.authenticator.Const.FORM_IMAGE_PUSH;
import static org.privacyidea.authenticator.Const.FORM_IMAGE_WEBAUTHN;
import static org.privacyidea.authenticator.Const.FORM_MODE;
import static org.privacyidea.authenticator.Const.FORM_MODE_CHANGED;
import static org.privacyidea.authenticator.Const.FORM_OTP;
import static org.privacyidea.authenticator.Const.FORM_OTP_AVAILABLE;
import static org.privacyidea.authenticator.Const.FORM_OTP_MESSAGE;
import static org.privacyidea.authenticator.Const.FORM_POLL_INTERVAL;
import static org.privacyidea.authenticator.Const.FORM_PUSH_AVAILABLE;
import static org.privacyidea.authenticator.Const.FORM_PUSH_MESSAGE;
import static org.privacyidea.authenticator.Const.FORM_TOKEN_ENROLLMENT_QR;
import static org.privacyidea.authenticator.Const.FORM_U2F_SIGN_REQUEST;
import static org.privacyidea.authenticator.Const.FORM_U2F_SIGN_RESPONSE;
import static org.privacyidea.authenticator.Const.FORM_UI_LANGUAGE;
import static org.privacyidea.authenticator.Const.FORM_WEBAUTHN_ORIGIN;
import static org.privacyidea.authenticator.Const.FORM_WEBAUTHN_SIGN_REQUEST;
import static org.privacyidea.authenticator.Const.FORM_WEBAUTHN_SIGN_RESPONSE;
import static org.privacyidea.authenticator.Const.HEADER_ACCEPT_LANGUAGE;
import static org.privacyidea.authenticator.Const.PLUGIN_USER_AGENT;
import static org.privacyidea.authenticator.Const.TRUE;
public class PrivacyIDEAAuthenticator implements org.keycloak.authentication.Authenticator, IPILogger
{
private final Logger logger = Logger.getLogger(PrivacyIDEAAuthenticator.class);
private final ConcurrentHashMap<String, Pair> piInstanceMap = new ConcurrentHashMap<>();
private boolean logEnabled = false;
/**
* Create new instances of PrivacyIDEA and the Configuration. Also adds them to the instance map.
*
* @param configMap configuration of the current request
* @param realm realm of the current request
* @return Pair of PrivacyIDEA and Configuration
*/
private Pair createInstance(Map<String, String> configMap, String realm)
{
Configuration config = new Configuration(configMap);
PrivacyIDEA privacyIDEA = PrivacyIDEA.newBuilder(config.serverURL(), PLUGIN_USER_AGENT)
.sslVerify(config.sslVerify())
.logger(this)
.realm(config.realm())
.serviceAccount(config.serviceAccountName(), config.serviceAccountPass())
.serviceRealm(config.serviceAccountRealm())
.build();
Pair pair = new Pair(privacyIDEA, config);
piInstanceMap.put(realm, pair);
return pair;
}
/**
* This function will be called when the authentication flow triggers the privacyIDEA execution.
* i.e. after the username + password have been submitted.
*
* @param context AuthenticationFlowContext
*/
@Override
public void authenticate(AuthenticationFlowContext context)
{
// Get the configuration and privacyIDEA instance for the current realm
// If none is found create new ones
String kcRealm = context.getRealm().getName();
Pair currentPair;
if (piInstanceMap.containsKey(kcRealm))
{
currentPair = piInstanceMap.get(kcRealm);
int incomingHash = context.getAuthenticatorConfig().getConfig().hashCode();
if (incomingHash != currentPair.configuration().configHash())
{
currentPair = createInstance(context.getAuthenticatorConfig().getConfig(), kcRealm);
log("Replacing privacyIDEA instance for realm " + kcRealm);
}
}
else
{
currentPair = createInstance(context.getAuthenticatorConfig().getConfig(), kcRealm);
log("Added new PI instance for realm " + kcRealm);
}
PrivacyIDEA privacyIDEA = currentPair.privacyIDEA();
Configuration config = currentPair.configuration();
logEnabled = config.doLog();
// Get the things that were submitted in the first username+password form
UserModel user = context.getUser();
String currentUser = user.getUsername();
// Check if the current user is member of an included or excluded group
if (!config.includedGroups().isEmpty())
{
if (user.getGroupsStream().map(GroupModel::getName).noneMatch(config.includedGroups()::contains))
{
context.success();
return;
}
}
else if (!config.excludedGroups().isEmpty())
{
if (user.getGroupsStream().map(GroupModel::getName).anyMatch(config.excludedGroups()::contains))
{
context.success();
return;
}
}
String currentPassword = null;
// In some cases, there will be no FormParameters so check if it is possible to even get the password
if (config.sendPassword() && context.getHttpRequest() != null && context.getHttpRequest().getDecodedFormParameters() != null &&
context.getHttpRequest().getDecodedFormParameters().get(PASSWORD) != null)
{
currentPassword = context.getHttpRequest().getDecodedFormParameters().get(PASSWORD).get(0);
}
Map<String, String> headers = getHeadersToForward(context, config);
// Set UI language
String uiLanguage = "en";
if (headers.get(HEADER_ACCEPT_LANGUAGE) != null && headers.get(HEADER_ACCEPT_LANGUAGE).startsWith("de"))
{
uiLanguage = "de";
}
// Prepare for possibly triggering challenges
PIResponse triggerResponse = null;
String pushMessage = uiLanguage.equals("en") ? DEFAULT_PUSH_MESSAGE_EN : DEFAULT_PUSH_MESSAGE_DE;
String otpMessage = uiLanguage.equals("en") ? DEFAULT_OTP_MESSAGE_EN : DEFAULT_OTP_MESSAGE_DE;
// Set the default values, always assume OTP is available
String tokenEnrollmentQR = "";
context.form()
.setAttribute(FORM_MODE, "otp")
.setAttribute(FORM_WEBAUTHN_SIGN_REQUEST, "")
.setAttribute(FORM_U2F_SIGN_REQUEST, "")
.setAttribute(FORM_PUSH_MESSAGE, pushMessage)
.setAttribute(FORM_OTP_AVAILABLE, true)
.setAttribute(FORM_OTP_MESSAGE, otpMessage)
.setAttribute(FORM_PUSH_AVAILABLE, false)
.setAttribute(FORM_IMAGE_PUSH, "")
.setAttribute(FORM_IMAGE_OTP, "")
.setAttribute(FORM_IMAGE_WEBAUTHN, "")
.setAttribute(FORM_POLL_INTERVAL, config.pollingInterval().get(0));
// Trigger challenges if configured. Service account has precedence over send password
if (config.triggerChallenge())
{
triggerResponse = privacyIDEA.triggerChallenges(currentUser, headers);
}
else if (config.sendPassword())
{
if (currentPassword != null)
{
triggerResponse = privacyIDEA.validateCheck(currentUser, currentPassword, null, headers);
}
else
{
log("Cannot send password because it is null!");
}
}
// Evaluate for possibly triggered token
if (triggerResponse != null)
{
if (triggerResponse.value)
{
context.success();
return;
}
if (triggerResponse.error != null)
{
context.form().setError(triggerResponse.error.message);
context.form().setAttribute(FORM_ERROR, true);
}
if (!triggerResponse.multichallenge.isEmpty())
{
extractChallengeDataToForm(triggerResponse, context, config);
}
// Enroll token if enabled and user does not have one. If something was triggered before, don't even try.
if (config.enrollToken() && (triggerResponse.transactionID == null || triggerResponse.transactionID.isEmpty()))
{
List<TokenInfo> tokenInfos = privacyIDEA.getTokenInfo(currentUser);
if (tokenInfos == null || tokenInfos.isEmpty())
{
RolloutInfo rolloutInfo = privacyIDEA.tokenRollout(currentUser, config.enrollingTokenType());
if (rolloutInfo != null)
{
if (rolloutInfo.error == null)
{
tokenEnrollmentQR = rolloutInfo.googleurl.img;
}
else
{
context.form().setError(rolloutInfo.error.message);
context.form().setAttribute(FORM_ERROR, true);
}
}
else
{
context.form().setError("Configuration error, please check the log file.");
}
}
}
}
// Prepare the form and auth notes to pass infos to the UI and the next step
context.getAuthenticationSession().setAuthNote(AUTH_NOTE_AUTH_COUNTER, "0");
Response responseForm = context.form()
.setAttribute(FORM_TOKEN_ENROLLMENT_QR, tokenEnrollmentQR)
.setAttribute(FORM_UI_LANGUAGE, uiLanguage)
.createForm(FORM_FILE_NAME);
context.challenge(responseForm);
}
/**
* This function will be called when the privacyIDEA form is submitted.
*
* @param context AuthenticationFlowContext
*/
@Override
public void action(AuthenticationFlowContext context)
{
String kcRealm = context.getRealm().getName();
PrivacyIDEA privacyIDEA;
Configuration config;
if (piInstanceMap.containsKey(kcRealm))
{
Pair pair = piInstanceMap.get(kcRealm);
privacyIDEA = pair.privacyIDEA();
config = pair.configuration();
}
else
{
throw new AuthenticationFlowException("No privacyIDEA configuration found for kc-realm " + kcRealm,
AuthenticationFlowError.IDENTITY_PROVIDER_NOT_FOUND);
}
MultivaluedMap<String, String> formData = context.getHttpRequest().getDecodedFormParameters();
if (formData.containsKey("cancel"))
{
context.cancelLogin();
return;
}
LoginFormsProvider form = context.form();
//logger.info("formData:");
//formData.forEach((k, v) -> logger.info("key=" + k + ", value=" + v));
// Get data from the privacyIDEA form
String tokenEnrollmentQR = formData.getFirst(FORM_TOKEN_ENROLLMENT_QR);
String currentMode = formData.getFirst(FORM_MODE);
boolean pushAvailable = TRUE.equals(formData.getFirst(FORM_PUSH_AVAILABLE));
boolean otpAvailable = TRUE.equals(formData.getFirst(FORM_OTP_AVAILABLE));
String pushMessage = formData.getFirst(FORM_PUSH_MESSAGE);
String otpMessage = formData.getFirst(FORM_OTP_MESSAGE);
String imagePush = formData.getFirst(FORM_IMAGE_PUSH);
String imageOTP = formData.getFirst(FORM_IMAGE_OTP);
String imageWebauthn = formData.getFirst(FORM_IMAGE_WEBAUTHN);
String tokenTypeChanged = formData.getFirst(FORM_MODE_CHANGED);
String uiLanguage = formData.getFirst(FORM_UI_LANGUAGE);
String transactionID = context.getAuthenticationSession().getAuthNote(AUTH_NOTE_TRANSACTION_ID);
String currentUserName = context.getUser().getUsername();
String webAuthnSignRequest = formData.getFirst(FORM_WEBAUTHN_SIGN_REQUEST);
String webAuthnSignResponse = formData.getFirst(FORM_WEBAUTHN_SIGN_RESPONSE);
// The origin is set by the form every time, no need to put it in the form again
String origin = formData.getFirst(FORM_WEBAUTHN_ORIGIN);
String u2fSignRequest = formData.getFirst(FORM_U2F_SIGN_REQUEST);
String u2fSignResponse = formData.getFirst(FORM_U2F_SIGN_RESPONSE);
// Prepare the failure message, the message from privacyIDEA will be appended if possible
String authenticationFailureMessage = "Authentication failed.";
// Set the "old" values again
form.setAttribute(FORM_TOKEN_ENROLLMENT_QR, tokenEnrollmentQR)
.setAttribute(FORM_MODE, currentMode)
.setAttribute(FORM_PUSH_AVAILABLE, pushAvailable)
.setAttribute(FORM_OTP_AVAILABLE, otpAvailable)
.setAttribute(FORM_WEBAUTHN_SIGN_REQUEST, webAuthnSignRequest)
.setAttribute(FORM_IMAGE_PUSH, imagePush)
.setAttribute(FORM_IMAGE_OTP, imageOTP)
.setAttribute(FORM_IMAGE_WEBAUTHN, imageWebauthn)
.setAttribute(FORM_U2F_SIGN_REQUEST, u2fSignRequest)
.setAttribute(FORM_UI_LANGUAGE, uiLanguage)
.setAttribute(FORM_PUSH_MESSAGE, (pushMessage == null ? DEFAULT_PUSH_MESSAGE_EN : pushMessage))
.setAttribute(FORM_OTP_MESSAGE, (otpMessage == null ? DEFAULT_OTP_MESSAGE_EN : otpMessage));
Map<String, String> headers = getHeadersToForward(context, config);
// Do not show the error message if something was triggered
boolean didTrigger = false;
PIResponse response = null;
// Send a request to privacyIDEA depending on the mode
if (TOKEN_TYPE_PUSH.equals(currentMode))
{
// In push mode, poll for the transaction id to see if the challenge has been answered
if (privacyIDEA.pollTransaction(transactionID))
{
// If the challenge has been answered, finalize with a call to validate check
response = privacyIDEA.validateCheck(currentUserName, "", transactionID, headers);
}
}
else if (webAuthnSignResponse != null && !webAuthnSignResponse.isEmpty())
{
if (origin == null || origin.isEmpty())
{
logger.error("Origin is missing for WebAuthn authentication!");
}
else
{
response = privacyIDEA.validateCheckWebAuthn(currentUserName, transactionID, webAuthnSignResponse, origin, headers);
}
}
else if (u2fSignResponse != null && !u2fSignResponse.isEmpty())
{
response = privacyIDEA.validateCheckU2F(currentUserName, transactionID, u2fSignResponse, headers);
}
else if (!TRUE.equals(tokenTypeChanged))
{
String otp = formData.getFirst(FORM_OTP);
// If the transaction id is not present, it will be not be added in validateCheck, so no need to check here
response = privacyIDEA.validateCheck(currentUserName, otp, transactionID, headers);
}
// Evaluate the response
if (response != null)
{
// On success, finish the execution
if (response.value)
{
context.success();
return;
}
if (response.error != null)
{
form.setError(response.error.message);
form.setAttribute(FORM_ERROR, true);
context.failureChallenge(AuthenticationFlowError.INVALID_USER, form.createForm(FORM_FILE_NAME));
return;
}
// If the authentication was not successful (yet), either the provided data was wrong
// or another challenge was triggered
if (!response.multichallenge.isEmpty())
{
extractChallengeDataToForm(response, context, config);
didTrigger = true;
}
else
{
// The authentication failed without triggering anything so the things that have been sent before were wrong
authenticationFailureMessage += "\n" + response.message;
}
}
// The authCounter is also used to determine the polling interval for push
// If the authCounter is bigger than the size of the polling interval list, repeat the last value in the list
int authCounter = Integer.parseInt(context.getAuthenticationSession().getAuthNote(AUTH_NOTE_AUTH_COUNTER)) + 1;
authCounter = (authCounter >= config.pollingInterval().size() ? config.pollingInterval().size() - 1 : authCounter);
context.getAuthenticationSession().setAuthNote(AUTH_NOTE_AUTH_COUNTER, Integer.toString(authCounter));
// The message variables could be overwritten if a challenge was triggered. Therefore, add them here at the end
form.setAttribute(FORM_POLL_INTERVAL, config.pollingInterval().get(authCounter));
// Do not display the error if the token type was switched or if another challenge was triggered
if (!(TRUE.equals(tokenTypeChanged)) && !didTrigger)
{
form.setError(TOKEN_TYPE_PUSH.equals(currentMode) ? "Authentication not verified yet." : authenticationFailureMessage);
}
Response responseForm = form.createForm(FORM_FILE_NAME);
context.failureChallenge(AuthenticationFlowError.INVALID_CREDENTIALS, responseForm);
}
private void extractChallengeDataToForm(PIResponse response, AuthenticationFlowContext context, Configuration config)
{
if (context == null || config == null)
{
error("extractChallengeDataToForm missing parameter!");
return;
}
// Variables to configure the UI
String webAuthnSignRequest = "";
String u2fSignRequest = "";
String mode = "otp";
if (response.transactionID != null && !response.transactionID.isEmpty())
{
context.getAuthenticationSession().setAuthNote(AUTH_NOTE_TRANSACTION_ID, response.transactionID);
}
// Check for the images
List<Challenge> multiChallenge = response.multichallenge;
for (Challenge c : multiChallenge)
{
if ("poll".equals(c.getClientMode()))
{
context.form().setAttribute(FORM_IMAGE_PUSH, c.getImage());
}
else if ("interactive".equals(c.getClientMode()))
{
context.form().setAttribute(FORM_IMAGE_OTP, c.getImage());
}
if ("webauthn".equals(c.getClientMode()))
{
context.form().setAttribute(FORM_IMAGE_WEBAUTHN, c.getImage());
}
}
// Check for Push
if (response.pushAvailable())
{
context.form().setAttribute(FORM_PUSH_AVAILABLE, true);
context.form().setAttribute(FORM_PUSH_MESSAGE, response.pushMessage());
}
// Check for WebAuthn and U2F
if (response.triggeredTokenTypes().contains(TOKEN_TYPE_WEBAUTHN))
{
webAuthnSignRequest = response.mergedSignRequest();
}
if (response.triggeredTokenTypes().contains(TOKEN_TYPE_U2F))
{
List<U2F> signRequests = response.u2fSignRequests();
if (!signRequests.isEmpty())
{
u2fSignRequest = signRequests.get(0).signRequest();
}
}
// Check if response from server contains preferred client mode
if (response.preferredClientMode != null && !response.preferredClientMode.isEmpty())
{
mode = response.preferredClientMode;
}
else
{
// Check if any triggered token matches the preferred token type
if (response.triggeredTokenTypes().contains(config.prefTokenType()))
{
mode = config.prefTokenType();
}
}
context.form()
.setAttribute(FORM_MODE, mode)
.setAttribute(FORM_WEBAUTHN_SIGN_REQUEST, webAuthnSignRequest)
.setAttribute(FORM_U2F_SIGN_REQUEST, u2fSignRequest)
.setAttribute(FORM_OTP_MESSAGE, response.otpMessage());
}
/**
* Extract the headers that should be forwarded to privacyIDEA from the original request to keycloak. The header names
* can be defined in the configuration of this provider. The accept-language header is included by default.
*
* @param context AuthenticationFlowContext
* @param config Configuration
* @return Map of headers
*/
private Map<String, String> getHeadersToForward(AuthenticationFlowContext context, Configuration config)
{
Map<String, String> headersToForward = new LinkedHashMap<>();
// Take all headers from config plus accept-language
config.forwardedHeaders().add(HEADER_ACCEPT_LANGUAGE);
for (String header : config.forwardedHeaders().stream().distinct().collect(Collectors.toList()))
{
List<String> headerValues = context.getSession().getContext().getRequestHeaders().getRequestHeaders().get(header);
if (headerValues != null && !headerValues.isEmpty())
{
String temp = String.join(",", headerValues);
headersToForward.put(header, temp);
}
else
{
log("No values for header " + header + " found.");
}
}
return headersToForward;
}
@Override
public boolean requiresUser()
{
return true;
}
@Override
public boolean configuredFor(KeycloakSession session, RealmModel realm, UserModel user)
{
return true;
}
@Override
public void setRequiredActions(KeycloakSession session, RealmModel realm, UserModel user)
{
}
@Override
public void close()
{
}
// IPILogger implementation
@Override
public void log(String message)
{
if (logEnabled)
{
logger.info("PrivacyIDEA Client: " + message);
}
}
@Override
public void error(String message)
{
if (logEnabled)
{
logger.error("PrivacyIDEA Client: " + message);
}
}
@Override
public void log(Throwable t)
{
if (logEnabled)
{
logger.info("PrivacyIDEA Client: ", t);
}
}
@Override
public void error(Throwable t)
{
if (logEnabled)
{
logger.error("PrivacyIDEA Client: ", t);
}
}
}