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

公開メンバ関数

void authenticate (AuthenticationFlowContext context)
 
void action (AuthenticationFlowContext context)
 
boolean requiresUser ()
 
boolean configuredFor (KeycloakSession session, RealmModel realm, UserModel user)
 
void setRequiredActions (KeycloakSession session, RealmModel realm, UserModel user)
 
String getDisplayType ()
 
String getReferenceCategory ()
 
boolean isConfigurable ()
 
AuthenticationExecutionModel.Requirement [] getRequirementChoices ()
 
boolean isUserSetupAllowed ()
 
String getHelpText ()
 
List< ProviderConfigProperty > getConfigProperties ()
 
void close ()
 
Authenticator create (KeycloakSession session)
 
void init (Config.Scope config)
 
void postInit (KeycloakSessionFactory factory)
 
String getId ()
 

静的公開変数類

static final String PROVIDER_ID = "reset-credentials-choose-user"
 
static final AuthenticationExecutionModel.Requirement [] REQUIREMENT_CHOICES
 

静的非公開変数類

static final Logger logger = Logger.getLogger(ResetCredentialChooseUser.class)
 

詳解

著者
Bill Burke
バージョン
Revision
1

関数詳解

◆ action()

void org.keycloak.authentication.authenticators.resetcred.ResetCredentialChooseUser.action ( AuthenticationFlowContext  context)
inline
80  {
81  EventBuilder event = context.getEvent();
82  MultivaluedMap<String, String> formData = context.getHttpRequest().getDecodedFormParameters();
83  String username = formData.getFirst("username");
84  if (username == null || username.isEmpty()) {
85  event.error(Errors.USERNAME_MISSING);
86  Response challenge = context.form()
87  .setError(Messages.MISSING_USERNAME)
88  .createPasswordReset();
89  context.failureChallenge(AuthenticationFlowError.INVALID_USER, challenge);
90  return;
91  }
92 
93  username = username.trim();
94 
95  RealmModel realm = context.getRealm();
96  UserModel user = context.getSession().users().getUserByUsername(username, realm);
97  if (user == null && realm.isLoginWithEmailAllowed() && username.contains("@")) {
98  user = context.getSession().users().getUserByEmail(username, realm);
99  }
100 
101  context.getAuthenticationSession().setAuthNote(AbstractUsernameFormAuthenticator.ATTEMPTED_USERNAME, username);
102 
103  // we don't want people guessing usernames, so if there is a problem, just continue, but don't set the user
104  // a null user will notify further executions, that this was a failure.
105  if (user == null) {
106  event.clone()
107  .detail(Details.USERNAME, username)
108  .error(Errors.USER_NOT_FOUND);
109  } else if (!user.isEnabled()) {
110  event.clone()
111  .detail(Details.USERNAME, username)
112  .user(user).error(Errors.USER_DISABLED);
113  } else {
114  context.setUser(user);
115  }
116 
117  context.success();
118  }
Definition: Messages.java:22
static final String MISSING_USERNAME
Definition: Messages.java:49
static final String ATTEMPTED_USERNAME
Definition: AbstractUsernameFormAuthenticator.java:52

◆ authenticate()

void org.keycloak.authentication.authenticators.resetcred.ResetCredentialChooseUser.authenticate ( AuthenticationFlowContext  context)
inline
52  {
53  String existingUserId = context.getAuthenticationSession().getAuthNote(AbstractIdpAuthenticator.EXISTING_USER_INFO);
54  if (existingUserId != null) {
55  UserModel existingUser = AbstractIdpAuthenticator.getExistingUser(context.getSession(), context.getRealm(), context.getAuthenticationSession());
56 
57  logger.debugf("Forget-password triggered when reauthenticating user after first broker login. Skipping reset-credential-choose-user screen and using user '%s' ", existingUser.getUsername());
58  context.setUser(existingUser);
59  context.success();
60  return;
61  }
62 
63  String actionTokenUserId = context.getAuthenticationSession().getAuthNote(DefaultActionTokenKey.ACTION_TOKEN_USER_ID);
64  if (actionTokenUserId != null) {
65  UserModel existingUser = context.getSession().users().getUserById(actionTokenUserId, context.getRealm());
66 
67  // Action token logics handles checks for user ID validity and user being enabled
68 
69  logger.debugf("Forget-password triggered when reauthenticating user after authentication via action token. Skipping reset-credential-choose-user screen and using user '%s' ", existingUser.getUsername());
70  context.setUser(existingUser);
71  context.success();
72  return;
73  }
74 
75  Response challenge = context.form().createPasswordReset();
76  context.challenge(challenge);
77  }
static final Logger logger
Definition: ResetCredentialChooseUser.java:47

◆ close()

void org.keycloak.authentication.authenticators.resetcred.ResetCredentialChooseUser.close ( )
inline
175  {
176 
177  }

◆ configuredFor()

boolean org.keycloak.authentication.authenticators.resetcred.ResetCredentialChooseUser.configuredFor ( KeycloakSession  session,
RealmModel  realm,
UserModel  user 
)
inline
126  {
127  return true;
128  }

◆ create()

Authenticator org.keycloak.authentication.authenticators.resetcred.ResetCredentialChooseUser.create ( KeycloakSession  session)
inline
180  {
181  return this;
182  }

◆ getConfigProperties()

List<ProviderConfigProperty> org.keycloak.authentication.authenticators.resetcred.ResetCredentialChooseUser.getConfigProperties ( )
inline
170  {
171  return null;
172  }

◆ getDisplayType()

String org.keycloak.authentication.authenticators.resetcred.ResetCredentialChooseUser.getDisplayType ( )
inline
136  {
137  return "Choose User";
138  }

◆ getHelpText()

String org.keycloak.authentication.authenticators.resetcred.ResetCredentialChooseUser.getHelpText ( )
inline
165  {
166  return "Choose a user to reset credentials for";
167  }

◆ getId()

String org.keycloak.authentication.authenticators.resetcred.ResetCredentialChooseUser.getId ( )
inline
195  {
196  return PROVIDER_ID;
197  }
static final String PROVIDER_ID
Definition: ResetCredentialChooseUser.java:49

◆ getReferenceCategory()

String org.keycloak.authentication.authenticators.resetcred.ResetCredentialChooseUser.getReferenceCategory ( )
inline
141  {
142  return null;
143  }

◆ getRequirementChoices()

AuthenticationExecutionModel.Requirement [] org.keycloak.authentication.authenticators.resetcred.ResetCredentialChooseUser.getRequirementChoices ( )
inline
155  {
156  return REQUIREMENT_CHOICES;
157  }
static final AuthenticationExecutionModel.Requirement [] REQUIREMENT_CHOICES
Definition: ResetCredentialChooseUser.java:150

◆ init()

void org.keycloak.authentication.authenticators.resetcred.ResetCredentialChooseUser.init ( Config.Scope  config)
inline
185  {
186 
187  }

◆ isConfigurable()

boolean org.keycloak.authentication.authenticators.resetcred.ResetCredentialChooseUser.isConfigurable ( )
inline
146  {
147  return false;
148  }

◆ isUserSetupAllowed()

boolean org.keycloak.authentication.authenticators.resetcred.ResetCredentialChooseUser.isUserSetupAllowed ( )
inline
160  {
161  return false;
162  }

◆ postInit()

void org.keycloak.authentication.authenticators.resetcred.ResetCredentialChooseUser.postInit ( KeycloakSessionFactory  factory)
inline
190  {
191 
192  }

◆ requiresUser()

boolean org.keycloak.authentication.authenticators.resetcred.ResetCredentialChooseUser.requiresUser ( )
inline
121  {
122  return false;
123  }

◆ setRequiredActions()

void org.keycloak.authentication.authenticators.resetcred.ResetCredentialChooseUser.setRequiredActions ( KeycloakSession  session,
RealmModel  realm,
UserModel  user 
)
inline
131  {
132 
133  }

メンバ詳解

◆ logger

final Logger org.keycloak.authentication.authenticators.resetcred.ResetCredentialChooseUser.logger = Logger.getLogger(ResetCredentialChooseUser.class)
staticprivate

◆ PROVIDER_ID

final String org.keycloak.authentication.authenticators.resetcred.ResetCredentialChooseUser.PROVIDER_ID = "reset-credentials-choose-user"
static

◆ REQUIREMENT_CHOICES

final AuthenticationExecutionModel.Requirement [] org.keycloak.authentication.authenticators.resetcred.ResetCredentialChooseUser.REQUIREMENT_CHOICES
static
初期値:
= {
AuthenticationExecutionModel.Requirement.REQUIRED
}

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