KEYCLOAK-2346 Add identity provider and external username to event when login via broker
This commit is contained in:
1 parent
1f9ec6a907
commit
dacb1ebd50
3 files changed
+8
-5
No files matched your search
@@ -135,7 +135,7 @@ public class AuthenticationManager {
|
||||
backchannelLogoutClientSession(session, realm, clientSession, userSession, uriInfo, headers);
|
||||
}
|
||||
if (logoutBroker) {
|
||||
String brokerId = userSession.getNote(IdentityBrokerService.BROKER_PROVIDER_ID);
|
||||
String brokerId = userSession.getNote(Details.IDENTITY_PROVIDER);
|
||||
if (brokerId != null) {
|
||||
IdentityProvider identityProvider = IdentityBrokerService.getIdentityProvider(session, realm, brokerId);
|
||||
try {
|
||||
@@ -234,7 +234,7 @@ public class AuthenticationManager {
|
||||
}
|
||||
|
||||
}
|
||||
String brokerId = userSession.getNote(IdentityBrokerService.BROKER_PROVIDER_ID);
|
||||
String brokerId = userSession.getNote(Details.IDENTITY_PROVIDER);
|
||||
if (brokerId != null) {
|
||||
IdentityProvider identityProvider = IdentityBrokerService.getIdentityProvider(session, realm, brokerId);
|
||||
Response response = identityProvider.keycloakInitiatedBrowserLogout(userSession, uriInfo, realm);
|
||||
|
||||
@@ -95,7 +95,6 @@ import static org.keycloak.models.Constants.ACCOUNT_MANAGEMENT_CLIENT_ID;
|
||||
public class IdentityBrokerService implements IdentityProvider.AuthenticationCallback {
|
||||
|
||||
private static final Logger LOGGER = Logger.getLogger(IdentityBrokerService.class);
|
||||
public static final String BROKER_PROVIDER_ID = "BROKER_PROVIDER_ID";
|
||||
|
||||
private final RealmModel realmModel;
|
||||
|
||||
@@ -517,7 +516,8 @@ public class IdentityBrokerService implements IdentityProvider.AuthenticationCal
|
||||
|
||||
TokenManager.attachClientSession(userSession, clientSession);
|
||||
context.getIdp().attachUserSession(userSession, clientSession, context);
|
||||
userSession.setNote(BROKER_PROVIDER_ID, providerId);
|
||||
userSession.setNote(Details.IDENTITY_PROVIDER, providerId);
|
||||
userSession.setNote(Details.IDENTITY_PROVIDER_USERNAME, context.getUsername());
|
||||
|
||||
if (isDebugEnabled()) {
|
||||
LOGGER.debugf("Performing local authentication for user [%s].", federatedUser);
|
||||
|
||||
@@ -780,7 +780,10 @@ public class LoginActionsService {
|
||||
.detail(Details.AUTH_METHOD, userSession.getAuthMethod())
|
||||
.detail(Details.USERNAME, userSession.getLoginUsername())
|
||||
.detail(Details.RESPONSE_TYPE, responseType)
|
||||
.detail(Details.RESPONSE_MODE, responseMode.toString().toLowerCase());
|
||||
.detail(Details.RESPONSE_MODE, responseMode.toString().toLowerCase())
|
||||
.detail(Details.IDENTITY_PROVIDER, userSession.getNote(Details.IDENTITY_PROVIDER))
|
||||
.detail(Details.IDENTITY_PROVIDER_USERNAME, userSession.getNote(Details.IDENTITY_PROVIDER_USERNAME));
|
||||
|
||||
if (userSession.isRememberMe()) {
|
||||
event.detail(Details.REMEMBER_ME, "true");
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user