Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MS custom idp & more custom execution steps #29

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

prepor
Copy link

@prepor prepor commented Nov 11, 2024

No description provided.

Comment on lines +54 to +56
Stream<FederatedIdentityModel> linkedAccounts = session.users().getFederatedIdentitiesStream(realm, user);

linkedAccounts.forEach(identity -> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Stream<FederatedIdentityModel> linkedAccounts = session.users().getFederatedIdentitiesStream(realm, user);
linkedAccounts.forEach(identity -> {
session.users().getFederatedIdentitiesStream(realm, user).forEach(identity -> {


import org.jboss.logging.Logger;

public class NeonIdpCreateUserIfUnique extends AbstractIdpAuthenticator {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public class NeonIdpCreateUserIfUnique extends AbstractIdpAuthenticator {
public class NeonIdpCreateUserIfUniqueAuthenticator extends AbstractIdpAuthenticator {


@Override
public boolean configuredFor(KeycloakSession session, RealmModel realm, UserModel user) {
return false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't it be true like in IdpCreateUserIfUniqueAuthenticator?

}

for (Map.Entry<String, List<String>> attr : serializedCtx.getAttributes().entrySet().stream()
.sorted(Map.Entry.comparingByKey()).toList()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to sort here?


@Override
public String getHelpText() {
return "Create User If Unique";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's clarify here how our implementation is different from the default one.


import org.jboss.logging.Logger;

public class NeonIdpEmailVerifyAuthenticator extends AbstractIdpAuthenticator {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public class NeonIdpEmailVerifyAuthenticator extends AbstractIdpAuthenticator {
public class NeonIdpEmailVerificationAuthenticator extends AbstractIdpAuthenticator {


public class NeonIdpEmailVerifyAuthenticator extends AbstractIdpAuthenticator {
public static final String VERIFIED_EMAIL = "VERIFIED_EMAIL";
private static Logger logger = Logger.getLogger(IdpEmailVerificationAuthenticator.class);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
private static Logger logger = Logger.getLogger(IdpEmailVerificationAuthenticator.class);
private static Logger logger = Logger.getLogger(NeonIdpEmailVerifyAuthenticator.class);


public class NeonIdpCreateUserIfUnique extends AbstractIdpAuthenticator {

private static Logger logger = Logger.getLogger(IdpEmailVerificationAuthenticator.class);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
private static Logger logger = Logger.getLogger(IdpEmailVerificationAuthenticator.class);
private static Logger logger = Logger.getLogger(NeonIdpCreateUserIfUnique.class);


@Override
public String getId() {
return "neonmicrosoft-user-attribute-mapper";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return "neonmicrosoft-user-attribute-mapper";
return "neon-microsoft-user-attribute-mapper";


import org.keycloak.broker.oidc.mappers.UserAttributeMapper;

public class MicrosoftUserAttributeMapper extends UserAttributeMapper {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since your MicrosoftIdentityProvider extends OIDCIdentityProvider, the builtin UserAttributeMapper might already be selectable for it, I think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants