keycloak-service
公開メンバ関数 | 静的公開変数類 | 静的非公開変数類 | 全メンバ一覧
org.keycloak.authentication.forms.RegistrationPassword クラス
org.keycloak.authentication.forms.RegistrationPassword の継承関係図
Inheritance graph
org.keycloak.authentication.forms.RegistrationPassword 連携図
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-password-action"
 

静的非公開変数類

static AuthenticationExecutionModel.Requirement [] REQUIREMENT_CHOICES
 

詳解

著者
Bill Burke
バージョン
Revision
1

関数詳解

◆ buildPage()

void org.keycloak.authentication.forms.RegistrationPassword.buildPage ( FormContext  context,
LoginFormsProvider  form 
)
inline
107  {
108  form.setAttribute("passwordRequired", true);
109  }

◆ close()

void org.keycloak.authentication.forms.RegistrationPassword.close ( )
inline
132  {
133 
134  }

◆ configuredFor()

boolean org.keycloak.authentication.forms.RegistrationPassword.configuredFor ( KeycloakSession  session,
RealmModel  realm,
UserModel  user 
)
inline
117  {
118  return true;
119  }

◆ create()

FormAction org.keycloak.authentication.forms.RegistrationPassword.create ( KeycloakSession  session)
inline
161  {
162  return this;
163  }

◆ getConfigProperties()

List<ProviderConfigProperty> org.keycloak.authentication.forms.RegistrationPassword.getConfigProperties ( )
inline
59  {
60  return null;
61  }

◆ getDisplayType()

String org.keycloak.authentication.forms.RegistrationPassword.getDisplayType ( )
inline
137  {
138  return "Password Validation";
139  }

◆ getHelpText()

String org.keycloak.authentication.forms.RegistrationPassword.getHelpText ( )
inline
54  {
55  return "Validates that password matches password confirmation field. It also will store password in user's credential store.";
56  }

◆ getId()

String org.keycloak.authentication.forms.RegistrationPassword.getId ( )
inline
176  {
177  return PROVIDER_ID;
178  }
static final String PROVIDER_ID
Definition: RegistrationPassword.java:51

◆ getReferenceCategory()

String org.keycloak.authentication.forms.RegistrationPassword.getReferenceCategory ( )
inline
142  {
143  return UserCredentialModel.PASSWORD;
144  }

◆ getRequirementChoices()

AuthenticationExecutionModel.Requirement [] org.keycloak.authentication.forms.RegistrationPassword.getRequirementChoices ( )
inline
156  {
157  return REQUIREMENT_CHOICES;
158  }
static AuthenticationExecutionModel.Requirement [] REQUIREMENT_CHOICES
Definition: RegistrationPassword.java:151

◆ init()

void org.keycloak.authentication.forms.RegistrationPassword.init ( Config.Scope  config)
inline
166  {
167 
168  }

◆ isConfigurable()

boolean org.keycloak.authentication.forms.RegistrationPassword.isConfigurable ( )
inline
147  {
148  return false;
149  }

◆ isUserSetupAllowed()

boolean org.keycloak.authentication.forms.RegistrationPassword.isUserSetupAllowed ( )
inline
127  {
128  return false;
129  }

◆ postInit()

void org.keycloak.authentication.forms.RegistrationPassword.postInit ( KeycloakSessionFactory  factory)
inline
171  {
172 
173  }

◆ requiresUser()

boolean org.keycloak.authentication.forms.RegistrationPassword.requiresUser ( )
inline
112  {
113  return false;
114  }

◆ setRequiredActions()

void org.keycloak.authentication.forms.RegistrationPassword.setRequiredActions ( KeycloakSession  session,
RealmModel  realm,
UserModel  user 
)
inline
122  {
123 
124  }

◆ success()

void org.keycloak.authentication.forms.RegistrationPassword.success ( FormContext  context)
inline
91  {
92  MultivaluedMap<String, String> formData = context.getHttpRequest().getDecodedFormParameters();
93  String password = formData.getFirst(RegistrationPage.FIELD_PASSWORD);
94  UserCredentialModel credentials = new UserCredentialModel();
95  credentials.setType(CredentialRepresentation.PASSWORD);
96  credentials.setValue(password);
97  UserModel user = context.getUser();
98  try {
99  context.getSession().userCredentialManager().updateCredential(context.getRealm(), user, UserCredentialModel.password(formData.getFirst("password"), false));
100  } catch (Exception me) {
101  user.addRequiredAction(UserModel.RequiredAction.UPDATE_PASSWORD);
102  }
103 
104  }

◆ validate()

void org.keycloak.authentication.forms.RegistrationPassword.validate ( ValidationContext  context)
inline
64  {
65  MultivaluedMap<String, String> formData = context.getHttpRequest().getDecodedFormParameters();
66  List<FormMessage> errors = new ArrayList<>();
67  context.getEvent().detail(Details.REGISTER_METHOD, "form");
68  if (Validation.isBlank(formData.getFirst(RegistrationPage.FIELD_PASSWORD))) {
69  errors.add(new FormMessage(RegistrationPage.FIELD_PASSWORD, Messages.MISSING_PASSWORD));
70  } else if (!formData.getFirst(RegistrationPage.FIELD_PASSWORD).equals(formData.getFirst(RegistrationPage.FIELD_PASSWORD_CONFIRM))) {
71  errors.add(new FormMessage(RegistrationPage.FIELD_PASSWORD_CONFIRM, Messages.INVALID_PASSWORD_CONFIRM));
72  }
73  if (formData.getFirst(RegistrationPage.FIELD_PASSWORD) != null) {
74  PolicyError err = context.getSession().getProvider(PasswordPolicyManagerProvider.class).validate(context.getRealm().isRegistrationEmailAsUsername() ? formData.getFirst(RegistrationPage.FIELD_EMAIL) : formData.getFirst(RegistrationPage.FIELD_USERNAME), formData.getFirst(RegistrationPage.FIELD_PASSWORD));
75  if (err != null)
76  errors.add(new FormMessage(RegistrationPage.FIELD_PASSWORD, err.getMessage(), err.getParameters()));
77  }
78 
79  if (errors.size() > 0) {
80  context.error(Errors.INVALID_REGISTRATION);
81  formData.remove(RegistrationPage.FIELD_PASSWORD);
82  formData.remove(RegistrationPage.FIELD_PASSWORD_CONFIRM);
83  context.validationError(formData, errors);
84  return;
85  } else {
86  context.success();
87  }
88  }

メンバ詳解

◆ PROVIDER_ID

final String org.keycloak.authentication.forms.RegistrationPassword.PROVIDER_ID = "registration-password-action"
static

◆ REQUIREMENT_CHOICES

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

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