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

公開メンバ関数

boolean requiresUser ()
 
boolean configuredFor (KeycloakSession session, RealmModel realm, UserModel user)
 
void authenticate (AuthenticationFlowContext context)
 
void action (AuthenticationFlowContext context)
 
void setRequiredActions (KeycloakSession session, RealmModel realm, UserModel user)
 
void close ()
 

静的公開メンバ関数

static UserModel getExistingUser (KeycloakSession session, RealmModel realm, AuthenticationSessionModel authSession)
 

静的公開変数類

static final String BROKERED_CONTEXT_NOTE = "BROKERED_CONTEXT"
 
static final String EXISTING_USER_INFO = "EXISTING_USER_INFO"
 
static final String UPDATE_PROFILE_EMAIL_CHANGED = "UPDATE_PROFILE_EMAIL_CHANGED"
 
static final String ENFORCE_UPDATE_PROFILE = "ENFORCE_UPDATE_PROFILE"
 
static final String BROKER_REGISTERED_NEW_USER = "BROKER_REGISTERED_NEW_USER"
 
static final String FIRST_BROKER_LOGIN_SUCCESS = "FIRST_BROKER_LOGIN_SUCCESS"
 

限定公開メンバ関数

void authenticateImpl (AuthenticationFlowContext context, SerializedBrokeredIdentityContext serializedCtx, BrokeredIdentityContext brokerContext)
 
void actionImpl (AuthenticationFlowContext context, SerializedBrokeredIdentityContext serializedCtx, BrokeredIdentityContext brokerContext)
 
void sendFailureChallenge (AuthenticationFlowContext context, Response.Status status, String eventError, String errorMessage, AuthenticationFlowError flowError)
 

静的非公開変数類

static Logger logger = Logger.getLogger(IdpAutoLinkAuthenticator.class)
 

詳解

著者
Ryan Slominski

関数詳解

◆ action()

void org.keycloak.authentication.authenticators.broker.AbstractIdpAuthenticator.action ( AuthenticationFlowContext  context)
inlineinherited
78  {
79  AuthenticationSessionModel clientSession = context.getAuthenticationSession();
80 
81  SerializedBrokeredIdentityContext serializedCtx = SerializedBrokeredIdentityContext.readFromAuthenticationSession(clientSession, BROKERED_CONTEXT_NOTE);
82  if (serializedCtx == null) {
83  throw new AuthenticationFlowException("Not found serialized context in clientSession", AuthenticationFlowError.IDENTITY_PROVIDER_ERROR);
84  }
85  BrokeredIdentityContext brokerContext = serializedCtx.deserialize(context.getSession(), clientSession);
86 
87  if (!brokerContext.getIdpConfig().isEnabled()) {
88  sendFailureChallenge(context, Response.Status.BAD_REQUEST, Errors.IDENTITY_PROVIDER_ERROR, Messages.IDENTITY_PROVIDER_UNEXPECTED_ERROR, AuthenticationFlowError.IDENTITY_PROVIDER_ERROR);
89  }
90 
91  actionImpl(context, serializedCtx, brokerContext);
92  }
static final String BROKERED_CONTEXT_NOTE
Definition: AbstractIdpAuthenticator.java:42
void sendFailureChallenge(AuthenticationFlowContext context, Response.Status status, String eventError, String errorMessage, AuthenticationFlowError flowError)
Definition: AbstractIdpAuthenticator.java:97
abstract void actionImpl(AuthenticationFlowContext context, SerializedBrokeredIdentityContext serializedCtx, BrokeredIdentityContext brokerContext)

◆ actionImpl()

void org.keycloak.authentication.authenticators.broker.IdpAutoLinkAuthenticator.actionImpl ( AuthenticationFlowContext  context,
SerializedBrokeredIdentityContext  serializedCtx,
BrokeredIdentityContext  brokerContext 
)
inlineprotected
53  {
54  authenticateImpl(context, serializedCtx, brokerContext);
55  }
void authenticateImpl(AuthenticationFlowContext context, SerializedBrokeredIdentityContext serializedCtx, BrokeredIdentityContext brokerContext)
Definition: IdpAutoLinkAuthenticator.java:38

◆ authenticate()

void org.keycloak.authentication.authenticators.broker.AbstractIdpAuthenticator.authenticate ( AuthenticationFlowContext  context)
inlineinherited
61  {
62  AuthenticationSessionModel authSession = context.getAuthenticationSession();
63 
64  SerializedBrokeredIdentityContext serializedCtx = SerializedBrokeredIdentityContext.readFromAuthenticationSession(authSession, BROKERED_CONTEXT_NOTE);
65  if (serializedCtx == null) {
66  throw new AuthenticationFlowException("Not found serialized context in clientSession", AuthenticationFlowError.IDENTITY_PROVIDER_ERROR);
67  }
68  BrokeredIdentityContext brokerContext = serializedCtx.deserialize(context.getSession(), authSession);
69 
70  if (!brokerContext.getIdpConfig().isEnabled()) {
71  sendFailureChallenge(context, Response.Status.BAD_REQUEST, Errors.IDENTITY_PROVIDER_ERROR, Messages.IDENTITY_PROVIDER_UNEXPECTED_ERROR, AuthenticationFlowError.IDENTITY_PROVIDER_ERROR);
72  }
73 
74  authenticateImpl(context, serializedCtx, brokerContext);
75  }
static final String BROKERED_CONTEXT_NOTE
Definition: AbstractIdpAuthenticator.java:42
void sendFailureChallenge(AuthenticationFlowContext context, Response.Status status, String eventError, String errorMessage, AuthenticationFlowError flowError)
Definition: AbstractIdpAuthenticator.java:97
abstract void authenticateImpl(AuthenticationFlowContext context, SerializedBrokeredIdentityContext serializedCtx, BrokeredIdentityContext brokerContext)

◆ authenticateImpl()

void org.keycloak.authentication.authenticators.broker.IdpAutoLinkAuthenticator.authenticateImpl ( AuthenticationFlowContext  context,
SerializedBrokeredIdentityContext  serializedCtx,
BrokeredIdentityContext  brokerContext 
)
inlineprotected
38  {
39  KeycloakSession session = context.getSession();
40  RealmModel realm = context.getRealm();
41  AuthenticationSessionModel authSession = context.getAuthenticationSession();
42 
43  UserModel existingUser = getExistingUser(session, realm, authSession);
44 
45  logger.debugf("User '%s' will auto link with identity provider '%s' . Identity provider username is '%s' ", existingUser.getUsername(),
46  brokerContext.getIdpConfig().getAlias(), brokerContext.getUsername());
47 
48  context.setUser(existingUser);
49  context.success();
50  }
static UserModel getExistingUser(KeycloakSession session, RealmModel realm, AuthenticationSessionModel authSession)
Definition: AbstractIdpAuthenticator.java:115
static Logger logger
Definition: IdpAutoLinkAuthenticator.java:35

◆ close()

void org.keycloak.authentication.authenticators.broker.AbstractIdpAuthenticator.close ( )
inlineinherited
111  {
112 
113  }

◆ configuredFor()

boolean org.keycloak.authentication.authenticators.broker.IdpAutoLinkAuthenticator.configuredFor ( KeycloakSession  session,
RealmModel  realm,
UserModel  user 
)
inline
63  {
64  return false;
65  }

◆ getExistingUser()

static UserModel org.keycloak.authentication.authenticators.broker.AbstractIdpAuthenticator.getExistingUser ( KeycloakSession  session,
RealmModel  realm,
AuthenticationSessionModel  authSession 
)
inlinestaticinherited
115  {
116  String existingUserId = authSession.getAuthNote(EXISTING_USER_INFO);
117  if (existingUserId == null) {
118  throw new AuthenticationFlowException("Unexpected state. There is no existing duplicated user identified in ClientSession",
119  AuthenticationFlowError.INTERNAL_ERROR);
120  }
121 
122  ExistingUserInfo duplication = ExistingUserInfo.deserialize(existingUserId);
123 
124  UserModel existingUser = session.users().getUserById(duplication.getExistingUserId(), realm);
125  if (existingUser == null) {
126  throw new AuthenticationFlowException("User with ID '" + existingUserId + "' not found.", AuthenticationFlowError.INVALID_USER);
127  }
128 
129  if (!existingUser.isEnabled()) {
130  throw new AuthenticationFlowException("User with ID '" + existingUserId + "', username '" + existingUser.getUsername() + "' disabled.", AuthenticationFlowError.USER_DISABLED);
131  }
132 
133  return existingUser;
134  }
static final String EXISTING_USER_INFO
Definition: AbstractIdpAuthenticator.java:45

◆ requiresUser()

boolean org.keycloak.authentication.authenticators.broker.IdpAutoLinkAuthenticator.requiresUser ( )
inline
58  {
59  return false;
60  }

◆ sendFailureChallenge()

void org.keycloak.authentication.authenticators.broker.AbstractIdpAuthenticator.sendFailureChallenge ( AuthenticationFlowContext  context,
Response.Status  status,
String  eventError,
String  errorMessage,
AuthenticationFlowError  flowError 
)
inlineprotectedinherited
97  {
98  context.getEvent().user(context.getUser())
99  .error(eventError);
100  Response challengeResponse = context.form()
101  .setError(errorMessage)
102  .createErrorPage(status);
103  context.failureChallenge(flowError, challengeResponse);
104  }

◆ setRequiredActions()

void org.keycloak.authentication.authenticators.broker.AbstractIdpAuthenticator.setRequiredActions ( KeycloakSession  session,
RealmModel  realm,
UserModel  user 
)
inlineinherited
107  {
108  }

メンバ詳解

◆ BROKER_REGISTERED_NEW_USER

final String org.keycloak.authentication.authenticators.broker.AbstractIdpAuthenticator.BROKER_REGISTERED_NEW_USER = "BROKER_REGISTERED_NEW_USER"
staticinherited

◆ BROKERED_CONTEXT_NOTE

final String org.keycloak.authentication.authenticators.broker.AbstractIdpAuthenticator.BROKERED_CONTEXT_NOTE = "BROKERED_CONTEXT"
staticinherited

◆ ENFORCE_UPDATE_PROFILE

final String org.keycloak.authentication.authenticators.broker.AbstractIdpAuthenticator.ENFORCE_UPDATE_PROFILE = "ENFORCE_UPDATE_PROFILE"
staticinherited

◆ EXISTING_USER_INFO

final String org.keycloak.authentication.authenticators.broker.AbstractIdpAuthenticator.EXISTING_USER_INFO = "EXISTING_USER_INFO"
staticinherited

◆ FIRST_BROKER_LOGIN_SUCCESS

final String org.keycloak.authentication.authenticators.broker.AbstractIdpAuthenticator.FIRST_BROKER_LOGIN_SUCCESS = "FIRST_BROKER_LOGIN_SUCCESS"
staticinherited

◆ logger

Logger org.keycloak.authentication.authenticators.broker.IdpAutoLinkAuthenticator.logger = Logger.getLogger(IdpAutoLinkAuthenticator.class)
staticprivate

◆ UPDATE_PROFILE_EMAIL_CHANGED

final String org.keycloak.authentication.authenticators.broker.AbstractIdpAuthenticator.UPDATE_PROFILE_EMAIL_CHANGED = "UPDATE_PROFILE_EMAIL_CHANGED"
staticinherited

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