keycloak-service
公開メンバ関数 | 静的公開変数類 | 静的非公開変数類 | 全メンバ一覧
org.keycloak.authentication.forms.RegistrationProfile クラス
org.keycloak.authentication.forms.RegistrationProfile の継承関係図
Inheritance graph
org.keycloak.authentication.forms.RegistrationProfile 連携図
Collaboration graph

公開メンバ関数

String getHelpText ()
 
List< ProviderConfigProperty > getConfigProperties ()
 
void validate (ValidationContext context)
 
void success (FormContext context)
 
void buildPage (FormContext context, LoginFormsProvider form)
 
boolean requiresUser ()
 
boolean configuredFor (KeycloakSession session, RealmModel realm, UserModel user)
 
void setRequiredActions (KeycloakSession session, RealmModel realm, UserModel user)
 
boolean isUserSetupAllowed ()
 
void close ()
 
String getDisplayType ()
 
String getReferenceCategory ()
 
boolean isConfigurable ()
 
AuthenticationExecutionModel.Requirement [] getRequirementChoices ()
 
FormAction create (KeycloakSession session)
 
void init (Config.Scope config)
 
void postInit (KeycloakSessionFactory factory)
 
String getId ()
 

静的公開変数類

static final String PROVIDER_ID = "registration-profile-action"
 

静的非公開変数類

static AuthenticationExecutionModel.Requirement [] REQUIREMENT_CHOICES
 

詳解

著者
Bill Burke
バージョン
Revision
1

関数詳解

◆ buildPage()

void org.keycloak.authentication.forms.RegistrationProfile.buildPage ( FormContext  context,
LoginFormsProvider  form 
)
inline
113  {
114  // complete
115  }

◆ close()

void org.keycloak.authentication.forms.RegistrationProfile.close ( )
inline
139  {
140 
141  }

◆ configuredFor()

boolean org.keycloak.authentication.forms.RegistrationProfile.configuredFor ( KeycloakSession  session,
RealmModel  realm,
UserModel  user 
)
inline
123  {
124  return true;
125  }

◆ create()

FormAction org.keycloak.authentication.forms.RegistrationProfile.create ( KeycloakSession  session)
inline
167  {
168  return this;
169  }

◆ getConfigProperties()

List<ProviderConfigProperty> org.keycloak.authentication.forms.RegistrationProfile.getConfigProperties ( )
inline
55  {
56  return null;
57  }

◆ getDisplayType()

String org.keycloak.authentication.forms.RegistrationProfile.getDisplayType ( )
inline
144  {
145  return "Profile Validation";
146  }

◆ getHelpText()

String org.keycloak.authentication.forms.RegistrationProfile.getHelpText ( )
inline
50  {
51  return "Validates email, first name, and last name attributes and stores them in user data.";
52  }

◆ getId()

String org.keycloak.authentication.forms.RegistrationProfile.getId ( )
inline
182  {
183  return PROVIDER_ID;
184  }
static final String PROVIDER_ID
Definition: RegistrationProfile.java:47

◆ getReferenceCategory()

String org.keycloak.authentication.forms.RegistrationProfile.getReferenceCategory ( )
inline
149  {
150  return null;
151  }

◆ getRequirementChoices()

AuthenticationExecutionModel.Requirement [] org.keycloak.authentication.forms.RegistrationProfile.getRequirementChoices ( )
inline
163  {
164  return REQUIREMENT_CHOICES;
165  }
static AuthenticationExecutionModel.Requirement [] REQUIREMENT_CHOICES
Definition: RegistrationProfile.java:158

◆ init()

void org.keycloak.authentication.forms.RegistrationProfile.init ( Config.Scope  config)
inline
172  {
173 
174  }

◆ isConfigurable()

boolean org.keycloak.authentication.forms.RegistrationProfile.isConfigurable ( )
inline
154  {
155  return false;
156  }

◆ isUserSetupAllowed()

boolean org.keycloak.authentication.forms.RegistrationProfile.isUserSetupAllowed ( )
inline
133  {
134  return false;
135  }

◆ postInit()

void org.keycloak.authentication.forms.RegistrationProfile.postInit ( KeycloakSessionFactory  factory)
inline
177  {
178 
179  }

◆ requiresUser()

boolean org.keycloak.authentication.forms.RegistrationProfile.requiresUser ( )
inline
118  {
119  return false;
120  }

◆ setRequiredActions()

void org.keycloak.authentication.forms.RegistrationProfile.setRequiredActions ( KeycloakSession  session,
RealmModel  realm,
UserModel  user 
)
inline
128  {
129 
130  }

◆ success()

void org.keycloak.authentication.forms.RegistrationProfile.success ( FormContext  context)
inline
104  {
105  UserModel user = context.getUser();
106  MultivaluedMap<String, String> formData = context.getHttpRequest().getDecodedFormParameters();
107  user.setFirstName(formData.getFirst(RegistrationPage.FIELD_FIRST_NAME));
108  user.setLastName(formData.getFirst(RegistrationPage.FIELD_LAST_NAME));
109  user.setEmail(formData.getFirst(RegistrationPage.FIELD_EMAIL));
110  }

◆ validate()

void org.keycloak.authentication.forms.RegistrationProfile.validate ( ValidationContext  context)
inline
60  {
61  MultivaluedMap<String, String> formData = context.getHttpRequest().getDecodedFormParameters();
62  List<FormMessage> errors = new ArrayList<>();
63 
64  context.getEvent().detail(Details.REGISTER_METHOD, "form");
65  String eventError = Errors.INVALID_REGISTRATION;
66 
67  if (Validation.isBlank(formData.getFirst((RegistrationPage.FIELD_FIRST_NAME)))) {
68  errors.add(new FormMessage(RegistrationPage.FIELD_FIRST_NAME, Messages.MISSING_FIRST_NAME));
69  }
70 
71  if (Validation.isBlank(formData.getFirst((RegistrationPage.FIELD_LAST_NAME)))) {
72  errors.add(new FormMessage(RegistrationPage.FIELD_LAST_NAME, Messages.MISSING_LAST_NAME));
73  }
74 
75  String email = formData.getFirst(Validation.FIELD_EMAIL);
76  boolean emailValid = true;
77  if (Validation.isBlank(email)) {
78  errors.add(new FormMessage(RegistrationPage.FIELD_EMAIL, Messages.MISSING_EMAIL));
79  emailValid = false;
80  } else if (!Validation.isEmailValid(email)) {
81  context.getEvent().detail(Details.EMAIL, email);
82  errors.add(new FormMessage(RegistrationPage.FIELD_EMAIL, Messages.INVALID_EMAIL));
83  emailValid = false;
84  }
85 
86  if (emailValid && !context.getRealm().isDuplicateEmailsAllowed() && context.getSession().users().getUserByEmail(email, context.getRealm()) != null) {
87  eventError = Errors.EMAIL_IN_USE;
88  formData.remove(Validation.FIELD_EMAIL);
89  context.getEvent().detail(Details.EMAIL, email);
90  errors.add(new FormMessage(RegistrationPage.FIELD_EMAIL, Messages.EMAIL_EXISTS));
91  }
92 
93  if (errors.size() > 0) {
94  context.error(eventError);
95  context.validationError(formData, errors);
96  return;
97 
98  } else {
99  context.success();
100  }
101  }

メンバ詳解

◆ PROVIDER_ID

final String org.keycloak.authentication.forms.RegistrationProfile.PROVIDER_ID = "registration-profile-action"
static

◆ REQUIREMENT_CHOICES

AuthenticationExecutionModel.Requirement [] org.keycloak.authentication.forms.RegistrationProfile.REQUIREMENT_CHOICES
staticprivate
初期値:
= {
AuthenticationExecutionModel.Requirement.REQUIRED,
AuthenticationExecutionModel.Requirement.DISABLED
}

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