keycloak
静的公開メンバ関数 | 静的公開変数類 | 静的非公開メンバ関数 | 全メンバ一覧
org.keycloak.models.utils.DefaultAuthenticationFlows クラス
org.keycloak.models.utils.DefaultAuthenticationFlows 連携図
Collaboration graph

静的公開メンバ関数

static void addFlows (RealmModel realm)
 
static void migrateFlows (RealmModel realm)
 
static void registrationFlow (RealmModel realm)
 
static void browserFlow (RealmModel realm)
 
static void resetCredentialsFlow (RealmModel realm)
 
static void directGrantFlow (RealmModel realm, boolean migrate)
 
static void browserFlow (RealmModel realm, boolean migrate)
 
static void addIdentityProviderAuthenticator (RealmModel realm, String defaultProvider)
 
static void clientAuthFlow (RealmModel realm)
 
static void firstBrokerLoginFlow (RealmModel realm, boolean migrate)
 
static void samlEcpProfile (RealmModel realm)
 
static void dockerAuthenticationFlow (final RealmModel realm)
 
static void httpChallengeFlow (RealmModel realm)
 

静的公開変数類

static final String REGISTRATION_FLOW = "registration"
 
static final String REGISTRATION_FORM_FLOW = "registration form"
 
static final String BROWSER_FLOW = "browser"
 
static final String DIRECT_GRANT_FLOW = "direct grant"
 
static final String RESET_CREDENTIALS_FLOW = "reset credentials"
 
static final String LOGIN_FORMS_FLOW = "forms"
 
static final String SAML_ECP_FLOW = "saml ecp"
 
static final String DOCKER_AUTH = "docker auth"
 
static final String HTTP_CHALLENGE_FLOW = "http challenge"
 
static final String CLIENT_AUTHENTICATION_FLOW = "clients"
 
static final String FIRST_BROKER_LOGIN_FLOW = "first broker login"
 
static final String FIRST_BROKER_LOGIN_HANDLE_EXISTING_SUBFLOW = "Handle Existing Account"
 
static final String IDP_REVIEW_PROFILE_CONFIG_ALIAS = "review profile config"
 
static final String IDP_CREATE_UNIQUE_USER_CONFIG_ALIAS = "create unique user config"
 

静的非公開メンバ関数

static boolean hasCredentialType (RealmModel realm, String type)
 

詳解

著者
Bill Burke
バージョン
Revision
1

関数詳解

◆ addFlows()

static void org.keycloak.models.utils.DefaultAuthenticationFlows.addFlows ( RealmModel  realm)
inlinestatic
55  {
56  if (realm.getFlowByAlias(BROWSER_FLOW) == null) browserFlow(realm);
57  if (realm.getFlowByAlias(DIRECT_GRANT_FLOW) == null) directGrantFlow(realm, false);
58  if (realm.getFlowByAlias(REGISTRATION_FLOW) == null) registrationFlow(realm);
59  if (realm.getFlowByAlias(RESET_CREDENTIALS_FLOW) == null) resetCredentialsFlow(realm);
60  if (realm.getFlowByAlias(CLIENT_AUTHENTICATION_FLOW) == null) clientAuthFlow(realm);
61  if (realm.getFlowByAlias(FIRST_BROKER_LOGIN_FLOW) == null) firstBrokerLoginFlow(realm, false);
62  if (realm.getFlowByAlias(SAML_ECP_FLOW) == null) samlEcpProfile(realm);
63  if (realm.getFlowByAlias(DOCKER_AUTH) == null) dockerAuthenticationFlow(realm);
64  if (realm.getFlowByAlias(HTTP_CHALLENGE_FLOW) == null) httpChallengeFlow(realm);
65  }
static final String REGISTRATION_FLOW
Definition: DefaultAuthenticationFlows.java:38
static void registrationFlow(RealmModel realm)
Definition: DefaultAuthenticationFlows.java:78
static void firstBrokerLoginFlow(RealmModel realm, boolean migrate)
Definition: DefaultAuthenticationFlows.java:410
static void samlEcpProfile(RealmModel realm)
Definition: DefaultAuthenticationFlows.java:534
static final String DOCKER_AUTH
Definition: DefaultAuthenticationFlows.java:45
static void dockerAuthenticationFlow(final RealmModel realm)
Definition: DefaultAuthenticationFlows.java:555
static void httpChallengeFlow(RealmModel realm)
Definition: DefaultAuthenticationFlows.java:577
static final String CLIENT_AUTHENTICATION_FLOW
Definition: DefaultAuthenticationFlows.java:48
static void directGrantFlow(RealmModel realm, boolean migrate)
Definition: DefaultAuthenticationFlows.java:212
static final String FIRST_BROKER_LOGIN_FLOW
Definition: DefaultAuthenticationFlows.java:49
static final String RESET_CREDENTIALS_FLOW
Definition: DefaultAuthenticationFlows.java:42
static final String BROWSER_FLOW
Definition: DefaultAuthenticationFlows.java:40
static final String DIRECT_GRANT_FLOW
Definition: DefaultAuthenticationFlows.java:41
static void browserFlow(RealmModel realm)
Definition: DefaultAuthenticationFlows.java:151
static final String HTTP_CHALLENGE_FLOW
Definition: DefaultAuthenticationFlows.java:46
static final String SAML_ECP_FLOW
Definition: DefaultAuthenticationFlows.java:44
static void resetCredentialsFlow(RealmModel realm)
Definition: DefaultAuthenticationFlows.java:165
static void clientAuthFlow(RealmModel realm)
Definition: DefaultAuthenticationFlows.java:366

◆ addIdentityProviderAuthenticator()

static void org.keycloak.models.utils.DefaultAuthenticationFlows.addIdentityProviderAuthenticator ( RealmModel  realm,
String  defaultProvider 
)
inlinestatic
327  {
328  String browserFlowId = null;
329  for (AuthenticationFlowModel f : realm.getAuthenticationFlows()) {
330  if (f.getAlias().equals(DefaultAuthenticationFlows.BROWSER_FLOW)) {
331  browserFlowId = f.getId();
332  break;
333  }
334  }
335 
336  if (browserFlowId != null) {
337  for (AuthenticationExecutionModel e : realm.getAuthenticationExecutions(browserFlowId)) {
338  if ("identity-provider-redirector".equals(e.getAuthenticator())) {
339  return;
340  }
341  }
342 
343  AuthenticationExecutionModel execution;
344  execution = new AuthenticationExecutionModel();
345  execution.setParentFlow(browserFlowId);
346  execution.setRequirement(AuthenticationExecutionModel.Requirement.ALTERNATIVE);
347  execution.setAuthenticator("identity-provider-redirector");
348  execution.setPriority(25);
349  execution.setAuthenticatorFlow(false);
350 
351  if (defaultProvider != null) {
352  AuthenticatorConfigModel configModel = new AuthenticatorConfigModel();
353 
354  Map<String, String> config = new HashMap<>();
355  config.put("defaultProvider", defaultProvider);
356  configModel.setConfig(config);
357  configModel = realm.addAuthenticatorConfig(configModel);
358 
359  execution.setAuthenticatorConfig(configModel.getId());
360  }
361 
362  realm.addAuthenticatorExecution(execution);
363  }
364  }

◆ browserFlow() [1/2]

static void org.keycloak.models.utils.DefaultAuthenticationFlows.browserFlow ( RealmModel  realm)
inlinestatic
151  {
152  browserFlow(realm, false);
153  }
static void browserFlow(RealmModel realm)
Definition: DefaultAuthenticationFlows.java:151

◆ browserFlow() [2/2]

static void org.keycloak.models.utils.DefaultAuthenticationFlows.browserFlow ( RealmModel  realm,
boolean  migrate 
)
inlinestatic
256  {
257  AuthenticationFlowModel browser = new AuthenticationFlowModel();
258  browser.setAlias(BROWSER_FLOW);
259  browser.setDescription("browser based authentication");
260  browser.setProviderId("basic-flow");
261  browser.setTopLevel(true);
262  browser.setBuiltIn(true);
263  browser = realm.addAuthenticationFlow(browser);
264  realm.setBrowserFlow(browser);
265 
266  AuthenticationExecutionModel execution = new AuthenticationExecutionModel();
267  execution.setParentFlow(browser.getId());
268  execution.setRequirement(AuthenticationExecutionModel.Requirement.ALTERNATIVE);
269  execution.setAuthenticator("auth-cookie");
270  execution.setPriority(10);
271  execution.setAuthenticatorFlow(false);
272  realm.addAuthenticatorExecution(execution);
273  execution = new AuthenticationExecutionModel();
274  execution.setParentFlow(browser.getId());
275  execution.setRequirement(AuthenticationExecutionModel.Requirement.DISABLED);
276  if (migrate && hasCredentialType(realm, RequiredCredentialModel.KERBEROS.getType())) {
277  execution.setRequirement(AuthenticationExecutionModel.Requirement.ALTERNATIVE);
278 
279  }
280  execution.setAuthenticator("auth-spnego");
281  execution.setPriority(20);
282  execution.setAuthenticatorFlow(false);
283  realm.addAuthenticatorExecution(execution);
284 
286 
287  AuthenticationFlowModel forms = new AuthenticationFlowModel();
288  forms.setTopLevel(false);
289  forms.setBuiltIn(true);
290  forms.setAlias(LOGIN_FORMS_FLOW);
291  forms.setDescription("Username, password, otp and other auth forms.");
292  forms.setProviderId("basic-flow");
293  forms = realm.addAuthenticationFlow(forms);
294  execution = new AuthenticationExecutionModel();
295  execution.setParentFlow(browser.getId());
296  execution.setRequirement(AuthenticationExecutionModel.Requirement.ALTERNATIVE);
297  execution.setFlowId(forms.getId());
298  execution.setPriority(30);
299  execution.setAuthenticatorFlow(true);
300  realm.addAuthenticatorExecution(execution);
301 
302  // forms
303  // Username Password processing
304  execution = new AuthenticationExecutionModel();
305  execution.setParentFlow(forms.getId());
306  execution.setRequirement(AuthenticationExecutionModel.Requirement.REQUIRED);
307  execution.setAuthenticator("auth-username-password-form");
308  execution.setPriority(10);
309  execution.setAuthenticatorFlow(false);
310  realm.addAuthenticatorExecution(execution);
311 
312  // otp processing
313  execution = new AuthenticationExecutionModel();
314  execution.setParentFlow(forms.getId());
315  execution.setRequirement(AuthenticationExecutionModel.Requirement.OPTIONAL);
316  if (migrate && hasCredentialType(realm, RequiredCredentialModel.TOTP.getType())) {
317  execution.setRequirement(AuthenticationExecutionModel.Requirement.REQUIRED);
318 
319  }
320 
321  execution.setAuthenticator("auth-otp-form");
322  execution.setPriority(20);
323  execution.setAuthenticatorFlow(false);
324  realm.addAuthenticatorExecution(execution);
325  }
static boolean hasCredentialType(RealmModel realm, String type)
Definition: DefaultAuthenticationFlows.java:155
static final String LOGIN_FORMS_FLOW
Definition: DefaultAuthenticationFlows.java:43
static final String BROWSER_FLOW
Definition: DefaultAuthenticationFlows.java:40
static void addIdentityProviderAuthenticator(RealmModel realm, String defaultProvider)
Definition: DefaultAuthenticationFlows.java:327

◆ clientAuthFlow()

static void org.keycloak.models.utils.DefaultAuthenticationFlows.clientAuthFlow ( RealmModel  realm)
inlinestatic
366  {
367  AuthenticationFlowModel clients = new AuthenticationFlowModel();
368  clients.setAlias(CLIENT_AUTHENTICATION_FLOW);
369  clients.setDescription("Base authentication for clients");
370  clients.setProviderId("client-flow");
371  clients.setTopLevel(true);
372  clients.setBuiltIn(true);
373  clients = realm.addAuthenticationFlow(clients);
374  realm.setClientAuthenticationFlow(clients);
375 
376  AuthenticationExecutionModel execution = new AuthenticationExecutionModel();
377  execution.setParentFlow(clients.getId());
378  execution.setRequirement(AuthenticationExecutionModel.Requirement.ALTERNATIVE);
379  execution.setAuthenticator("client-secret");
380  execution.setPriority(10);
381  execution.setAuthenticatorFlow(false);
382  realm.addAuthenticatorExecution(execution);
383 
384  execution = new AuthenticationExecutionModel();
385  execution.setParentFlow(clients.getId());
386  execution.setRequirement(AuthenticationExecutionModel.Requirement.ALTERNATIVE);
387  execution.setAuthenticator("client-jwt");
388  execution.setPriority(20);
389  execution.setAuthenticatorFlow(false);
390  realm.addAuthenticatorExecution(execution);
391 
392  execution = new AuthenticationExecutionModel();
393  execution.setParentFlow(clients.getId());
394  execution.setRequirement(AuthenticationExecutionModel.Requirement.ALTERNATIVE);
395  execution.setAuthenticator("client-secret-jwt");
396  execution.setPriority(30);
397  execution.setAuthenticatorFlow(false);
398  realm.addAuthenticatorExecution(execution);
399 
400  execution = new AuthenticationExecutionModel();
401  execution.setParentFlow(clients.getId());
402  execution.setRequirement(AuthenticationExecutionModel.Requirement.ALTERNATIVE);
403  execution.setAuthenticator("client-x509");
404  execution.setPriority(40);
405  execution.setAuthenticatorFlow(false);
406  realm.addAuthenticatorExecution(execution);
407 
408  }
static final String CLIENT_AUTHENTICATION_FLOW
Definition: DefaultAuthenticationFlows.java:48

◆ directGrantFlow()

static void org.keycloak.models.utils.DefaultAuthenticationFlows.directGrantFlow ( RealmModel  realm,
boolean  migrate 
)
inlinestatic
212  {
213  AuthenticationFlowModel grant = new AuthenticationFlowModel();
214  grant.setAlias(DIRECT_GRANT_FLOW);
215  grant.setDescription("OpenID Connect Resource Owner Grant");
216  grant.setProviderId("basic-flow");
217  grant.setTopLevel(true);
218  grant.setBuiltIn(true);
219  grant = realm.addAuthenticationFlow(grant);
220  realm.setDirectGrantFlow(grant);
221 
222  // username
223  AuthenticationExecutionModel execution = new AuthenticationExecutionModel();
224  execution.setParentFlow(grant.getId());
225  execution.setRequirement(AuthenticationExecutionModel.Requirement.REQUIRED);
226  execution.setAuthenticator("direct-grant-validate-username");
227  execution.setPriority(10);
228  execution.setAuthenticatorFlow(false);
229  realm.addAuthenticatorExecution(execution);
230 
231  // password
232  execution = new AuthenticationExecutionModel();
233  execution.setParentFlow(grant.getId());
234  execution.setRequirement(AuthenticationExecutionModel.Requirement.REQUIRED);
235  if (migrate && !hasCredentialType(realm, RequiredCredentialModel.PASSWORD.getType())) {
236  execution.setRequirement(AuthenticationExecutionModel.Requirement.DISABLED);
237  }
238  execution.setAuthenticator("direct-grant-validate-password");
239  execution.setPriority(20);
240  execution.setAuthenticatorFlow(false);
241  realm.addAuthenticatorExecution(execution);
242 
243  // otp
244  execution = new AuthenticationExecutionModel();
245  execution.setParentFlow(grant.getId());
246  execution.setRequirement(AuthenticationExecutionModel.Requirement.OPTIONAL);
247  if (migrate && hasCredentialType(realm, RequiredCredentialModel.TOTP.getType())) {
248  execution.setRequirement(AuthenticationExecutionModel.Requirement.REQUIRED);
249  }
250  execution.setAuthenticator("direct-grant-validate-otp");
251  execution.setPriority(30);
252  execution.setAuthenticatorFlow(false);
253  realm.addAuthenticatorExecution(execution);
254  }
static boolean hasCredentialType(RealmModel realm, String type)
Definition: DefaultAuthenticationFlows.java:155
static final String DIRECT_GRANT_FLOW
Definition: DefaultAuthenticationFlows.java:41

◆ dockerAuthenticationFlow()

static void org.keycloak.models.utils.DefaultAuthenticationFlows.dockerAuthenticationFlow ( final RealmModel  realm)
inlinestatic
555  {
556  AuthenticationFlowModel dockerAuthFlow = new AuthenticationFlowModel();
557 
558  dockerAuthFlow.setAlias(DOCKER_AUTH);
559  dockerAuthFlow.setDescription("Used by Docker clients to authenticate against the IDP");
560  dockerAuthFlow.setProviderId("basic-flow");
561  dockerAuthFlow.setTopLevel(true);
562  dockerAuthFlow.setBuiltIn(true);
563  dockerAuthFlow = realm.addAuthenticationFlow(dockerAuthFlow);
564  realm.setDockerAuthenticationFlow(dockerAuthFlow);
565 
566  AuthenticationExecutionModel execution = new AuthenticationExecutionModel();
567 
568  execution.setParentFlow(dockerAuthFlow.getId());
569  execution.setRequirement(AuthenticationExecutionModel.Requirement.REQUIRED);
570  execution.setAuthenticator("docker-http-basic-authenticator");
571  execution.setPriority(10);
572  execution.setAuthenticatorFlow(false);
573 
574  realm.addAuthenticatorExecution(execution);
575  }
static final String DOCKER_AUTH
Definition: DefaultAuthenticationFlows.java:45

◆ firstBrokerLoginFlow()

static void org.keycloak.models.utils.DefaultAuthenticationFlows.firstBrokerLoginFlow ( RealmModel  realm,
boolean  migrate 
)
inlinestatic
410  {
411  AuthenticationFlowModel firstBrokerLogin = new AuthenticationFlowModel();
412  firstBrokerLogin.setAlias(FIRST_BROKER_LOGIN_FLOW);
413  firstBrokerLogin.setDescription("Actions taken after first broker login with identity provider account, which is not yet linked to any Keycloak account");
414  firstBrokerLogin.setProviderId("basic-flow");
415  firstBrokerLogin.setTopLevel(true);
416  firstBrokerLogin.setBuiltIn(true);
417  firstBrokerLogin = realm.addAuthenticationFlow(firstBrokerLogin);
418 
419  AuthenticatorConfigModel reviewProfileConfig = new AuthenticatorConfigModel();
420  reviewProfileConfig.setAlias(IDP_REVIEW_PROFILE_CONFIG_ALIAS);
421  Map<String, String> config = new HashMap<>();
422  config.put("update.profile.on.first.login", IdentityProviderRepresentation.UPFLM_MISSING);
423  reviewProfileConfig.setConfig(config);
424  reviewProfileConfig = realm.addAuthenticatorConfig(reviewProfileConfig);
425 
426  AuthenticationExecutionModel execution = new AuthenticationExecutionModel();
427  execution.setParentFlow(firstBrokerLogin.getId());
428  execution.setRequirement(AuthenticationExecutionModel.Requirement.REQUIRED);
429  execution.setAuthenticator("idp-review-profile");
430  execution.setPriority(10);
431  execution.setAuthenticatorFlow(false);
432  execution.setAuthenticatorConfig(reviewProfileConfig.getId());
433  realm.addAuthenticatorExecution(execution);
434 
435 
436  AuthenticatorConfigModel createUserIfUniqueConfig = new AuthenticatorConfigModel();
437  createUserIfUniqueConfig.setAlias(IDP_CREATE_UNIQUE_USER_CONFIG_ALIAS);
438  config = new HashMap<>();
439  config.put("require.password.update.after.registration", "false");
440  createUserIfUniqueConfig.setConfig(config);
441  createUserIfUniqueConfig = realm.addAuthenticatorConfig(createUserIfUniqueConfig);
442 
443  execution = new AuthenticationExecutionModel();
444  execution.setParentFlow(firstBrokerLogin.getId());
445  execution.setRequirement(AuthenticationExecutionModel.Requirement.ALTERNATIVE);
446  execution.setAuthenticator("idp-create-user-if-unique");
447  execution.setPriority(20);
448  execution.setAuthenticatorFlow(false);
449  execution.setAuthenticatorConfig(createUserIfUniqueConfig.getId());
450  realm.addAuthenticatorExecution(execution);
451 
452 
453  AuthenticationFlowModel linkExistingAccountFlow = new AuthenticationFlowModel();
454  linkExistingAccountFlow.setTopLevel(false);
455  linkExistingAccountFlow.setBuiltIn(true);
456  linkExistingAccountFlow.setAlias(FIRST_BROKER_LOGIN_HANDLE_EXISTING_SUBFLOW);
457  linkExistingAccountFlow.setDescription("Handle what to do if there is existing account with same email/username like authenticated identity provider");
458  linkExistingAccountFlow.setProviderId("basic-flow");
459  linkExistingAccountFlow = realm.addAuthenticationFlow(linkExistingAccountFlow);
460  execution = new AuthenticationExecutionModel();
461  execution.setParentFlow(firstBrokerLogin.getId());
462  execution.setRequirement(AuthenticationExecutionModel.Requirement.ALTERNATIVE);
463  execution.setFlowId(linkExistingAccountFlow.getId());
464  execution.setPriority(30);
465  execution.setAuthenticatorFlow(true);
466  realm.addAuthenticatorExecution(execution);
467 
468  execution = new AuthenticationExecutionModel();
469  execution.setParentFlow(linkExistingAccountFlow.getId());
470  execution.setRequirement(AuthenticationExecutionModel.Requirement.REQUIRED);
471  execution.setAuthenticator("idp-confirm-link");
472  execution.setPriority(10);
473  execution.setAuthenticatorFlow(false);
474  realm.addAuthenticatorExecution(execution);
475 
476  execution = new AuthenticationExecutionModel();
477  execution.setParentFlow(linkExistingAccountFlow.getId());
478  execution.setRequirement(AuthenticationExecutionModel.Requirement.ALTERNATIVE);
479  execution.setAuthenticator("idp-email-verification");
480  execution.setPriority(20);
481  execution.setAuthenticatorFlow(false);
482  realm.addAuthenticatorExecution(execution);
483 
484  AuthenticationFlowModel verifyByReauthenticationAccountFlow = new AuthenticationFlowModel();
485  verifyByReauthenticationAccountFlow.setTopLevel(false);
486  verifyByReauthenticationAccountFlow.setBuiltIn(true);
487  verifyByReauthenticationAccountFlow.setAlias("Verify Existing Account by Re-authentication");
488  verifyByReauthenticationAccountFlow.setDescription("Reauthentication of existing account");
489  verifyByReauthenticationAccountFlow.setProviderId("basic-flow");
490  verifyByReauthenticationAccountFlow = realm.addAuthenticationFlow(verifyByReauthenticationAccountFlow);
491  execution = new AuthenticationExecutionModel();
492  execution.setParentFlow(linkExistingAccountFlow.getId());
493  execution.setRequirement(AuthenticationExecutionModel.Requirement.ALTERNATIVE);
494  execution.setFlowId(verifyByReauthenticationAccountFlow.getId());
495  execution.setPriority(30);
496  execution.setAuthenticatorFlow(true);
497  realm.addAuthenticatorExecution(execution);
498 
499  // password + otp
500  execution = new AuthenticationExecutionModel();
501  execution.setParentFlow(verifyByReauthenticationAccountFlow.getId());
502  execution.setRequirement(AuthenticationExecutionModel.Requirement.REQUIRED);
503  execution.setAuthenticator("idp-username-password-form");
504  execution.setPriority(10);
505  execution.setAuthenticatorFlow(false);
506  realm.addAuthenticatorExecution(execution);
507 
508  execution = new AuthenticationExecutionModel();
509  execution.setParentFlow(verifyByReauthenticationAccountFlow.getId());
510  execution.setRequirement(AuthenticationExecutionModel.Requirement.OPTIONAL);
511 
512  if (migrate) {
513  // Try to read OTP requirement from browser flow
514  AuthenticationFlowModel browserFlow = realm.getBrowserFlow();
515  if (browserFlow == null) {
516  browserFlow = realm.getFlowByAlias(DefaultAuthenticationFlows.BROWSER_FLOW);
517  }
518 
519  List<AuthenticationExecutionModel> browserExecutions = new LinkedList<>();
520  KeycloakModelUtils.deepFindAuthenticationExecutions(realm, browserFlow, browserExecutions);
521  for (AuthenticationExecutionModel browserExecution : browserExecutions) {
522  if (browserExecution.getAuthenticator().equals("auth-otp-form")) {
523  execution.setRequirement(browserExecution.getRequirement());
524  }
525  }
526  }
527 
528  execution.setAuthenticator("auth-otp-form");
529  execution.setPriority(20);
530  execution.setAuthenticatorFlow(false);
531  realm.addAuthenticatorExecution(execution);
532  }
static final String FIRST_BROKER_LOGIN_HANDLE_EXISTING_SUBFLOW
Definition: DefaultAuthenticationFlows.java:50
static final String FIRST_BROKER_LOGIN_FLOW
Definition: DefaultAuthenticationFlows.java:49
static void browserFlow(RealmModel realm)
Definition: DefaultAuthenticationFlows.java:151
static final String IDP_CREATE_UNIQUE_USER_CONFIG_ALIAS
Definition: DefaultAuthenticationFlows.java:53
static final String IDP_REVIEW_PROFILE_CONFIG_ALIAS
Definition: DefaultAuthenticationFlows.java:52

◆ hasCredentialType()

static boolean org.keycloak.models.utils.DefaultAuthenticationFlows.hasCredentialType ( RealmModel  realm,
String  type 
)
inlinestaticprivate
155  {
156  for (RequiredCredentialModel requiredCredentialModel : realm.getRequiredCredentials()) {
157  if (type.equals(requiredCredentialModel.getType())) {
158  return true;
159  }
160 
161  }
162  return false;
163  }

◆ httpChallengeFlow()

static void org.keycloak.models.utils.DefaultAuthenticationFlows.httpChallengeFlow ( RealmModel  realm)
inlinestatic
577  {
578  AuthenticationFlowModel challengeFlow = new AuthenticationFlowModel();
579  challengeFlow.setAlias(HTTP_CHALLENGE_FLOW);
580  challengeFlow.setDescription("An authentication flow based on challenge-response HTTP Authentication Schemes");
581  challengeFlow.setProviderId("basic-flow");
582  challengeFlow.setTopLevel(true);
583  challengeFlow.setBuiltIn(true);
584  challengeFlow = realm.addAuthenticationFlow(challengeFlow);
585 
586  AuthenticationExecutionModel execution = new AuthenticationExecutionModel();
587  execution.setParentFlow(challengeFlow.getId());
588  execution.setRequirement(AuthenticationExecutionModel.Requirement.REQUIRED);
589  execution.setAuthenticator("no-cookie-redirect");
590  execution.setPriority(10);
591  execution.setAuthenticatorFlow(false);
592  realm.addAuthenticatorExecution(execution);
593 
594  execution = new AuthenticationExecutionModel();
595  execution.setParentFlow(challengeFlow.getId());
596  execution.setRequirement(AuthenticationExecutionModel.Requirement.REQUIRED);
597  execution.setAuthenticator("basic-auth");
598  execution.setPriority(20);
599  execution.setAuthenticatorFlow(false);
600  realm.addAuthenticatorExecution(execution);
601 
602  execution = new AuthenticationExecutionModel();
603  execution.setParentFlow(challengeFlow.getId());
604  execution.setRequirement(AuthenticationExecutionModel.Requirement.DISABLED);
605  execution.setAuthenticator("basic-auth-otp");
606  execution.setPriority(30);
607  execution.setAuthenticatorFlow(false);
608  realm.addAuthenticatorExecution(execution);
609 
610  execution = new AuthenticationExecutionModel();
611  execution.setParentFlow(challengeFlow.getId());
612  execution.setRequirement(AuthenticationExecutionModel.Requirement.DISABLED);
613  execution.setAuthenticator("auth-spnego");
614  execution.setPriority(40);
615  execution.setAuthenticatorFlow(false);
616  realm.addAuthenticatorExecution(execution);
617  }
static final String HTTP_CHALLENGE_FLOW
Definition: DefaultAuthenticationFlows.java:46

◆ migrateFlows()

static void org.keycloak.models.utils.DefaultAuthenticationFlows.migrateFlows ( RealmModel  realm)
inlinestatic
66  {
67  if (realm.getFlowByAlias(BROWSER_FLOW) == null) browserFlow(realm, true);
68  if (realm.getFlowByAlias(DIRECT_GRANT_FLOW) == null) directGrantFlow(realm, true);
69  if (realm.getFlowByAlias(REGISTRATION_FLOW) == null) registrationFlow(realm);
70  if (realm.getFlowByAlias(RESET_CREDENTIALS_FLOW) == null) resetCredentialsFlow(realm);
71  if (realm.getFlowByAlias(CLIENT_AUTHENTICATION_FLOW) == null) clientAuthFlow(realm);
72  if (realm.getFlowByAlias(FIRST_BROKER_LOGIN_FLOW) == null) firstBrokerLoginFlow(realm, true);
73  if (realm.getFlowByAlias(SAML_ECP_FLOW) == null) samlEcpProfile(realm);
74  if (realm.getFlowByAlias(DOCKER_AUTH) == null) dockerAuthenticationFlow(realm);
75  if (realm.getFlowByAlias(HTTP_CHALLENGE_FLOW) == null) httpChallengeFlow(realm);
76  }
static final String REGISTRATION_FLOW
Definition: DefaultAuthenticationFlows.java:38
static void registrationFlow(RealmModel realm)
Definition: DefaultAuthenticationFlows.java:78
static void firstBrokerLoginFlow(RealmModel realm, boolean migrate)
Definition: DefaultAuthenticationFlows.java:410
static void samlEcpProfile(RealmModel realm)
Definition: DefaultAuthenticationFlows.java:534
static final String DOCKER_AUTH
Definition: DefaultAuthenticationFlows.java:45
static void dockerAuthenticationFlow(final RealmModel realm)
Definition: DefaultAuthenticationFlows.java:555
static void httpChallengeFlow(RealmModel realm)
Definition: DefaultAuthenticationFlows.java:577
static final String CLIENT_AUTHENTICATION_FLOW
Definition: DefaultAuthenticationFlows.java:48
static void directGrantFlow(RealmModel realm, boolean migrate)
Definition: DefaultAuthenticationFlows.java:212
static final String FIRST_BROKER_LOGIN_FLOW
Definition: DefaultAuthenticationFlows.java:49
static final String RESET_CREDENTIALS_FLOW
Definition: DefaultAuthenticationFlows.java:42
static final String BROWSER_FLOW
Definition: DefaultAuthenticationFlows.java:40
static final String DIRECT_GRANT_FLOW
Definition: DefaultAuthenticationFlows.java:41
static void browserFlow(RealmModel realm)
Definition: DefaultAuthenticationFlows.java:151
static final String HTTP_CHALLENGE_FLOW
Definition: DefaultAuthenticationFlows.java:46
static final String SAML_ECP_FLOW
Definition: DefaultAuthenticationFlows.java:44
static void resetCredentialsFlow(RealmModel realm)
Definition: DefaultAuthenticationFlows.java:165
static void clientAuthFlow(RealmModel realm)
Definition: DefaultAuthenticationFlows.java:366

◆ registrationFlow()

static void org.keycloak.models.utils.DefaultAuthenticationFlows.registrationFlow ( RealmModel  realm)
inlinestatic
78  {
79  AuthenticationFlowModel registrationFlow = new AuthenticationFlowModel();
80  registrationFlow.setAlias(REGISTRATION_FLOW);
81  registrationFlow.setDescription("registration flow");
82  registrationFlow.setProviderId("basic-flow");
83  registrationFlow.setTopLevel(true);
84  registrationFlow.setBuiltIn(true);
85  registrationFlow = realm.addAuthenticationFlow(registrationFlow);
86  realm.setRegistrationFlow(registrationFlow);
87 
88  AuthenticationFlowModel registrationFormFlow = new AuthenticationFlowModel();
89  registrationFormFlow.setAlias(REGISTRATION_FORM_FLOW);
90  registrationFormFlow.setDescription("registration form");
91  registrationFormFlow.setProviderId("form-flow");
92  registrationFormFlow.setTopLevel(false);
93  registrationFormFlow.setBuiltIn(true);
94  registrationFormFlow = realm.addAuthenticationFlow(registrationFormFlow);
95 
96  AuthenticationExecutionModel execution;
97 
98  execution = new AuthenticationExecutionModel();
99  execution.setParentFlow(registrationFlow.getId());
100  execution.setRequirement(AuthenticationExecutionModel.Requirement.REQUIRED);
101  execution.setAuthenticator("registration-page-form");
102  execution.setPriority(10);
103  execution.setAuthenticatorFlow(true);
104  execution.setFlowId(registrationFormFlow.getId());
105  realm.addAuthenticatorExecution(execution);
106 
107  execution = new AuthenticationExecutionModel();
108  execution.setParentFlow(registrationFormFlow.getId());
109  execution.setRequirement(AuthenticationExecutionModel.Requirement.REQUIRED);
110  execution.setAuthenticator("registration-user-creation");
111  execution.setPriority(20);
112  execution.setAuthenticatorFlow(false);
113  realm.addAuthenticatorExecution(execution);
114 
115  execution = new AuthenticationExecutionModel();
116  execution.setParentFlow(registrationFormFlow.getId());
117  execution.setRequirement(AuthenticationExecutionModel.Requirement.REQUIRED);
118  execution.setAuthenticator("registration-profile-action");
119  execution.setPriority(40);
120  execution.setAuthenticatorFlow(false);
121  realm.addAuthenticatorExecution(execution);
122 
123  execution = new AuthenticationExecutionModel();
124  execution.setParentFlow(registrationFormFlow.getId());
125  execution.setRequirement(AuthenticationExecutionModel.Requirement.REQUIRED);
126  execution.setAuthenticator("registration-password-action");
127  execution.setPriority(50);
128  execution.setAuthenticatorFlow(false);
129  realm.addAuthenticatorExecution(execution);
130 
131  //AuthenticatorConfigModel captchaConfig = new AuthenticatorConfigModel();
132  //captchaConfig.setAlias("Recaptcha Config");
133  //Map<String, String> config = new HashMap<>();
134  //config.put("site.key", "6LcFEAkTAAAAAOaY-5RJk3zIYw4AalNtqfac27Bn");
135  //config.put("secret", "6LcFEAkTAAAAAM0SErEs9NlfhYpOTRj_vOVJSAMI");
136  //captchaConfig.setConfig(config);
137  //captchaConfig = realm.addAuthenticatorConfig(captchaConfig);
138  execution = new AuthenticationExecutionModel();
139  execution.setParentFlow(registrationFormFlow.getId());
140  execution.setRequirement(AuthenticationExecutionModel.Requirement.DISABLED);
141  execution.setAuthenticator("registration-recaptcha-action");
142  execution.setPriority(60);
143  execution.setAuthenticatorFlow(false);
144  //execution.setAuthenticatorConfig(captchaConfig.getId());
145  realm.addAuthenticatorExecution(execution);
146 
147 
148 
149  }
static final String REGISTRATION_FLOW
Definition: DefaultAuthenticationFlows.java:38
static void registrationFlow(RealmModel realm)
Definition: DefaultAuthenticationFlows.java:78
static final String REGISTRATION_FORM_FLOW
Definition: DefaultAuthenticationFlows.java:39

◆ resetCredentialsFlow()

static void org.keycloak.models.utils.DefaultAuthenticationFlows.resetCredentialsFlow ( RealmModel  realm)
inlinestatic
165  {
166  AuthenticationFlowModel grant = new AuthenticationFlowModel();
167  grant.setAlias(RESET_CREDENTIALS_FLOW);
168  grant.setDescription("Reset credentials for a user if they forgot their password or something");
169  grant.setProviderId("basic-flow");
170  grant.setTopLevel(true);
171  grant.setBuiltIn(true);
172  grant = realm.addAuthenticationFlow(grant);
173  realm.setResetCredentialsFlow(grant);
174 
175  // username
176  AuthenticationExecutionModel execution = new AuthenticationExecutionModel();
177  execution.setParentFlow(grant.getId());
178  execution.setRequirement(AuthenticationExecutionModel.Requirement.REQUIRED);
179  execution.setAuthenticator("reset-credentials-choose-user");
180  execution.setPriority(10);
181  execution.setAuthenticatorFlow(false);
182  realm.addAuthenticatorExecution(execution);
183 
184  // send email
185  execution = new AuthenticationExecutionModel();
186  execution.setParentFlow(grant.getId());
187  execution.setRequirement(AuthenticationExecutionModel.Requirement.REQUIRED);
188  execution.setAuthenticator("reset-credential-email");
189  execution.setPriority(20);
190  execution.setAuthenticatorFlow(false);
191  realm.addAuthenticatorExecution(execution);
192 
193  // password
194  execution = new AuthenticationExecutionModel();
195  execution.setParentFlow(grant.getId());
196  execution.setRequirement(AuthenticationExecutionModel.Requirement.REQUIRED);
197  execution.setAuthenticator("reset-password");
198  execution.setPriority(30);
199  execution.setAuthenticatorFlow(false);
200  realm.addAuthenticatorExecution(execution);
201 
202  // otp
203  execution = new AuthenticationExecutionModel();
204  execution.setParentFlow(grant.getId());
205  execution.setRequirement(AuthenticationExecutionModel.Requirement.OPTIONAL);
206  execution.setAuthenticator("reset-otp");
207  execution.setPriority(40);
208  execution.setAuthenticatorFlow(false);
209  realm.addAuthenticatorExecution(execution);
210  }
static final String RESET_CREDENTIALS_FLOW
Definition: DefaultAuthenticationFlows.java:42

◆ samlEcpProfile()

static void org.keycloak.models.utils.DefaultAuthenticationFlows.samlEcpProfile ( RealmModel  realm)
inlinestatic
534  {
535  AuthenticationFlowModel ecpFlow = new AuthenticationFlowModel();
536 
537  ecpFlow.setAlias(SAML_ECP_FLOW);
538  ecpFlow.setDescription("SAML ECP Profile Authentication Flow");
539  ecpFlow.setProviderId("basic-flow");
540  ecpFlow.setTopLevel(true);
541  ecpFlow.setBuiltIn(true);
542  ecpFlow = realm.addAuthenticationFlow(ecpFlow);
543 
544  AuthenticationExecutionModel execution = new AuthenticationExecutionModel();
545 
546  execution.setParentFlow(ecpFlow.getId());
547  execution.setRequirement(AuthenticationExecutionModel.Requirement.REQUIRED);
548  execution.setAuthenticator("http-basic-authenticator");
549  execution.setPriority(10);
550  execution.setAuthenticatorFlow(false);
551 
552  realm.addAuthenticatorExecution(execution);
553  }
static final String SAML_ECP_FLOW
Definition: DefaultAuthenticationFlows.java:44

メンバ詳解

◆ BROWSER_FLOW

final String org.keycloak.models.utils.DefaultAuthenticationFlows.BROWSER_FLOW = "browser"
static

◆ CLIENT_AUTHENTICATION_FLOW

final String org.keycloak.models.utils.DefaultAuthenticationFlows.CLIENT_AUTHENTICATION_FLOW = "clients"
static

◆ DIRECT_GRANT_FLOW

final String org.keycloak.models.utils.DefaultAuthenticationFlows.DIRECT_GRANT_FLOW = "direct grant"
static

◆ DOCKER_AUTH

final String org.keycloak.models.utils.DefaultAuthenticationFlows.DOCKER_AUTH = "docker auth"
static

◆ FIRST_BROKER_LOGIN_FLOW

final String org.keycloak.models.utils.DefaultAuthenticationFlows.FIRST_BROKER_LOGIN_FLOW = "first broker login"
static

◆ FIRST_BROKER_LOGIN_HANDLE_EXISTING_SUBFLOW

final String org.keycloak.models.utils.DefaultAuthenticationFlows.FIRST_BROKER_LOGIN_HANDLE_EXISTING_SUBFLOW = "Handle Existing Account"
static

◆ HTTP_CHALLENGE_FLOW

final String org.keycloak.models.utils.DefaultAuthenticationFlows.HTTP_CHALLENGE_FLOW = "http challenge"
static

◆ IDP_CREATE_UNIQUE_USER_CONFIG_ALIAS

final String org.keycloak.models.utils.DefaultAuthenticationFlows.IDP_CREATE_UNIQUE_USER_CONFIG_ALIAS = "create unique user config"
static

◆ IDP_REVIEW_PROFILE_CONFIG_ALIAS

final String org.keycloak.models.utils.DefaultAuthenticationFlows.IDP_REVIEW_PROFILE_CONFIG_ALIAS = "review profile config"
static

◆ LOGIN_FORMS_FLOW

final String org.keycloak.models.utils.DefaultAuthenticationFlows.LOGIN_FORMS_FLOW = "forms"
static

◆ REGISTRATION_FLOW

final String org.keycloak.models.utils.DefaultAuthenticationFlows.REGISTRATION_FLOW = "registration"
static

◆ REGISTRATION_FORM_FLOW

final String org.keycloak.models.utils.DefaultAuthenticationFlows.REGISTRATION_FORM_FLOW = "registration form"
static

◆ RESET_CREDENTIALS_FLOW

final String org.keycloak.models.utils.DefaultAuthenticationFlows.RESET_CREDENTIALS_FLOW = "reset credentials"
static

◆ SAML_ECP_FLOW

final String org.keycloak.models.utils.DefaultAuthenticationFlows.SAML_ECP_FLOW = "saml ecp"
static

このクラス詳解は次のファイルから抽出されました: