keycloak
公開メンバ関数 | 静的公開変数類 | 限定公開メンバ関数 | 全メンバ一覧
org.keycloak.authentication.authenticators.directgrant.ValidateUsername クラス
org.keycloak.authentication.authenticators.directgrant.ValidateUsername の継承関係図
Inheritance graph
org.keycloak.authentication.authenticators.directgrant.ValidateUsername 連携図
Collaboration graph

公開メンバ関数

void authenticate (AuthenticationFlowContext context)
 
boolean requiresUser ()
 
boolean configuredFor (KeycloakSession session, RealmModel realm, UserModel user)
 
void setRequiredActions (KeycloakSession session, RealmModel realm, UserModel user)
 
boolean isUserSetupAllowed ()
 
String getDisplayType ()
 
String getReferenceCategory ()
 
boolean isConfigurable ()
 
AuthenticationExecutionModel.Requirement [] getRequirementChoices ()
 
String getHelpText ()
 
List< ProviderConfigPropertygetConfigProperties ()
 
String getId ()
 
Response errorResponse (int status, String error, String errorDescription)
 
void action (AuthenticationFlowContext context)
 
void close ()
 
Authenticator create (KeycloakSession session)
 
void init (Config.Scope config)
 
void postInit (KeycloakSessionFactory factory)
 
default int order ()
 

静的公開変数類

static final String PROVIDER_ID = "direct-grant-validate-username"
 
static final AuthenticationExecutionModel.Requirement [] REQUIREMENT_CHOICES
 

限定公開メンバ関数

String retrieveUsername (AuthenticationFlowContext context)
 

詳解

著者
Bill Burke
バージョン
Revision
1

関数詳解

◆ action()

void org.keycloak.authentication.authenticators.directgrant.AbstractDirectGrantAuthenticator.action ( AuthenticationFlowContext  context)
inlineinherited

org.keycloak.authentication.Authenticatorを実装しています。

42  {
43 
44  }

◆ authenticate()

void org.keycloak.authentication.authenticators.directgrant.ValidateUsername.authenticate ( AuthenticationFlowContext  context)
inline

org.keycloak.authentication.Authenticatorを実装しています。

49  {
50  String username = retrieveUsername(context);
51  if (username == null) {
52  context.getEvent().error(Errors.USER_NOT_FOUND);
53  Response challengeResponse = errorResponse(Response.Status.UNAUTHORIZED.getStatusCode(), "invalid_request", "Missing parameter: username");
54  context.failure(AuthenticationFlowError.INVALID_USER, challengeResponse);
55  return;
56  }
57  context.getEvent().detail(Details.USERNAME, username);
58  context.getAuthenticationSession().setAuthNote(AbstractUsernameFormAuthenticator.ATTEMPTED_USERNAME, username);
59 
60  UserModel user = null;
61  try {
62  user = KeycloakModelUtils.findUserByNameOrEmail(context.getSession(), context.getRealm(), username);
63  } catch (ModelDuplicateException mde) {
64  ServicesLogger.LOGGER.modelDuplicateException(mde);
65  Response challengeResponse = errorResponse(Response.Status.UNAUTHORIZED.getStatusCode(), "invalid_request", "Invalid user credentials");
66  context.failure(AuthenticationFlowError.INVALID_USER, challengeResponse);
67  return;
68  }
69 
70 
71  if (user == null) {
72  context.getEvent().error(Errors.INVALID_USER_CREDENTIALS);
73  Response challengeResponse = errorResponse(Response.Status.UNAUTHORIZED.getStatusCode(), "invalid_grant", "Invalid user credentials");
74  context.failure(AuthenticationFlowError.INVALID_USER, challengeResponse);
75  return;
76  }
77  if (!user.isEnabled()) {
78  context.getEvent().user(user);
79  context.getEvent().error(Errors.USER_DISABLED);
80  Response challengeResponse = errorResponse(Response.Status.BAD_REQUEST.getStatusCode(), "invalid_grant", "Account disabled");
81  context.failure(AuthenticationFlowError.INVALID_USER, challengeResponse);
82  return;
83  }
84  if (context.getRealm().isBruteForceProtected()) {
85  if (context.getProtector().isTemporarilyDisabled(context.getSession(), context.getRealm(), user)) {
86  context.getEvent().user(user);
87  context.getEvent().error(Errors.USER_TEMPORARILY_DISABLED);
88  Response challengeResponse = errorResponse(Response.Status.UNAUTHORIZED.getStatusCode(), "invalid_grant", "Invalid user credentials");
89  context.failure(AuthenticationFlowError.INVALID_USER, challengeResponse);
90  return;
91  }
92  }
93  context.setUser(user);
94  context.success();
95  }
Response errorResponse(int status, String error, String errorDescription)
Definition: AbstractDirectGrantAuthenticator.java:36
String retrieveUsername(AuthenticationFlowContext context)
Definition: ValidateUsername.java:157

◆ close()

void org.keycloak.authentication.authenticators.directgrant.AbstractDirectGrantAuthenticator.close ( )
inlineinherited

org.keycloak.provider.Providerを実装しています。

47  {
48 
49  }

◆ configuredFor()

boolean org.keycloak.authentication.authenticators.directgrant.ValidateUsername.configuredFor ( KeycloakSession  session,
RealmModel  realm,
UserModel  user 
)
inline

org.keycloak.authentication.Authenticatorを実装しています。

103  {
104  return true;
105  }

◆ create()

Authenticator org.keycloak.authentication.authenticators.directgrant.AbstractDirectGrantAuthenticator.create ( KeycloakSession  session)
inlineinherited

org.keycloak.provider.ProviderFactory< T extends Provider >を実装しています。

52  {
53  return this;
54  }

◆ errorResponse()

Response org.keycloak.authentication.authenticators.directgrant.AbstractDirectGrantAuthenticator.errorResponse ( int  status,
String  error,
String  errorDescription 
)
inlineinherited
36  {
37  OAuth2ErrorRepresentation errorRep = new OAuth2ErrorRepresentation(error, errorDescription);
38  return Response.status(status).entity(errorRep).type(MediaType.APPLICATION_JSON_TYPE).build();
39  }

◆ getConfigProperties()

List<ProviderConfigProperty> org.keycloak.authentication.authenticators.directgrant.ValidateUsername.getConfigProperties ( )
inline

org.keycloak.provider.ConfiguredProviderを実装しています。

148  {
149  return new LinkedList<>();
150  }

◆ getDisplayType()

String org.keycloak.authentication.authenticators.directgrant.ValidateUsername.getDisplayType ( )
inline

org.keycloak.authentication.ConfigurableAuthenticatorFactoryを実装しています。

119  {
120  return "Username Validation";
121  }

◆ getHelpText()

String org.keycloak.authentication.authenticators.directgrant.ValidateUsername.getHelpText ( )
inline

org.keycloak.provider.ConfiguredProviderを実装しています。

143  {
144  return "Validates the username supplied as a 'username' form parameter in direct grant request";
145  }

◆ getId()

String org.keycloak.authentication.authenticators.directgrant.ValidateUsername.getId ( )
inline

org.keycloak.provider.ProviderFactory< T extends Provider >を実装しています。

153  {
154  return PROVIDER_ID;
155  }
static final String PROVIDER_ID
Definition: ValidateUsername.java:46

◆ getReferenceCategory()

String org.keycloak.authentication.authenticators.directgrant.ValidateUsername.getReferenceCategory ( )
inline

org.keycloak.authentication.ConfigurableAuthenticatorFactoryを実装しています。

124  {
125  return null;
126  }

◆ getRequirementChoices()

AuthenticationExecutionModel.Requirement [] org.keycloak.authentication.authenticators.directgrant.ValidateUsername.getRequirementChoices ( )
inline

org.keycloak.authentication.ConfigurableAuthenticatorFactoryを実装しています。

138  {
139  return REQUIREMENT_CHOICES;
140  }
static final AuthenticationExecutionModel.Requirement [] REQUIREMENT_CHOICES
Definition: ValidateUsername.java:133

◆ init()

void org.keycloak.authentication.authenticators.directgrant.AbstractDirectGrantAuthenticator.init ( Config.Scope  config)
inlineinherited

org.keycloak.provider.ProviderFactory< T extends Provider >を実装しています。

57  {
58 
59  }

◆ isConfigurable()

boolean org.keycloak.authentication.authenticators.directgrant.ValidateUsername.isConfigurable ( )
inline

org.keycloak.authentication.ConfigurableAuthenticatorFactoryを実装しています。

129  {
130  return false;
131  }

◆ isUserSetupAllowed()

boolean org.keycloak.authentication.authenticators.directgrant.ValidateUsername.isUserSetupAllowed ( )
inline

org.keycloak.authentication.ConfigurableAuthenticatorFactoryを実装しています。

113  {
114  return false;
115  }

◆ order()

default int org.keycloak.provider.ProviderFactory< T extends Provider >.order ( )
inlineinherited

◆ postInit()

void org.keycloak.authentication.authenticators.directgrant.AbstractDirectGrantAuthenticator.postInit ( KeycloakSessionFactory  factory)
inlineinherited

org.keycloak.provider.ProviderFactory< T extends Provider >を実装しています。

62  {
63 
64  }

◆ requiresUser()

boolean org.keycloak.authentication.authenticators.directgrant.ValidateUsername.requiresUser ( )
inline

org.keycloak.authentication.Authenticatorを実装しています。

98  {
99  return false;
100  }

◆ retrieveUsername()

String org.keycloak.authentication.authenticators.directgrant.ValidateUsername.retrieveUsername ( AuthenticationFlowContext  context)
inlineprotected
157  {
158  MultivaluedMap<String, String> inputData = context.getHttpRequest().getDecodedFormParameters();
159  return inputData.getFirst(AuthenticationManager.FORM_USERNAME);
160  }

◆ setRequiredActions()

void org.keycloak.authentication.authenticators.directgrant.ValidateUsername.setRequiredActions ( KeycloakSession  session,
RealmModel  realm,
UserModel  user 
)
inline

org.keycloak.authentication.Authenticatorを実装しています。

108  {
109 
110  }

メンバ詳解

◆ PROVIDER_ID

final String org.keycloak.authentication.authenticators.directgrant.ValidateUsername.PROVIDER_ID = "direct-grant-validate-username"
static

◆ REQUIREMENT_CHOICES

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

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